al-quran.reflectslight.io/rake/tasks/nanoc.rake

35 lines
830 B
Ruby
Raw Normal View History

2024-06-19 23:36:03 +02:00
# frozen_string_literal: true
2023-07-25 20:32:57 +02:00
namespace :nanoc do
2024-06-19 23:47:17 +02:00
desc "Clean directories"
2023-07-25 20:32:57 +02:00
task :clean do
2024-06-22 07:17:13 +02:00
Dir.chdir(dirs.root) do
sh "rm -rf node_modules/.cache/"
2024-08-30 15:16:42 +02:00
sh "rm -rf #{nanoc.output_dir}/*"
2024-02-24 02:38:50 +01:00
sh "rm -rf tmp/"
end
2023-07-25 20:32:57 +02:00
end
2024-06-19 23:47:17 +02:00
desc "Produce the build directory"
task :build, %i[buildenv] => %i[setenv] do |t, args|
Nanoc::CLI.run(["compile"])
end
2024-06-19 23:47:17 +02:00
desc "Produce the build directory on-demand"
task :watch, %i[buildenv] => %i[setenv nanoc:build] do |t, args|
require "listen"
2024-06-22 07:17:13 +02:00
Listen.to(dirs.content) {
Nanoc::CLI.run(["compile"])
2024-06-22 07:17:13 +02:00
}.start
sleep
rescue Interrupt
warn "SIGINT: exit"
2023-11-27 22:18:10 +01:00
exit
2023-07-25 20:32:57 +02:00
end
task :setenv, %i[buildenv] do |t, args|
2024-06-22 07:17:13 +02:00
ENV["SASS_PATH"] = File.join(dirs.content, "css")
ENV["buildenv"] = args.buildenv || ENV["buildenv"] || "development"
end
2023-07-25 20:32:57 +02:00
end