dolphins7.skeleton/twenty-frontend/tasks/nanoc.rake

37 lines
837 B
Ruby
Raw Normal View History

namespace :nanoc do
2024-02-10 00:27:50 +01:00
require "bundler/setup"
2024-02-08 04:11:27 +01:00
cwd = File.realpath File.join(__dir__, "..")
desc "Clean the build/ directory"
task :clean do
Dir.chdir(cwd) do
sh "rm -rf build"
end
end
desc "Produce the build/ directory"
task :build do
2024-02-08 04:11:27 +01:00
Dir.chdir(cwd) do
# FIXME: discover why rm -rf build/css/ is needed.
ENV["NODE_ENV"] = "production"
sh "rm -rf build/css/"
2024-02-10 00:27:50 +01:00
Bundler.with_unbundled_env { sh "bundle exec nanoc co" }
2024-02-08 04:11:27 +01:00
end
end
desc "Produce the build/ directory on-demand"
task watch: ['nanoc:build'] do
2024-02-10 00:27:50 +01:00
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"
exit
end
end