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

39 lines
907 B
Ruby
Raw Normal View History

2023-07-25 20:32:57 +02:00
namespace :nanoc do
require "bundler/setup"
cwd = File.realpath File.join(__dir__, "..")
2023-07-25 20:32:57 +02:00
desc "Clean the build/ directory"
2023-07-25 20:32:57 +02:00
task :clean do
Dir.chdir(cwd) do
sh "rm -rf node_modules/.cache/"
sh "rm -rf build"
end
2023-07-25 20:32:57 +02:00
end
desc "Produce the build/ directory"
task :build, [:buildenv] do |t, args|
Dir.chdir(cwd) do
buildenv = args.buildenv || ENV["buildenv"] || "development"
sh "rm -rf build/css/"
Bundler.with_unbundled_env {
sh "buildenv=#{buildenv} bundle exec nanoc co"
}
end
end
desc "Produce the build/ directory on-demand"
task watch: ['nanoc:build'] do
Dir.chdir(cwd) do
require "listen"
path = File.join(Dir.getwd, "src")
Listen.to(path) do
Bundler.with_unbundled_env { sh "rake nanoc:build" }
end.start
sleep
end
rescue Interrupt
warn "SIGINT: exit"
2023-11-27 22:18:10 +01:00
exit
2023-07-25 20:32:57 +02:00
end
end