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

39 lines
907 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
2024-02-16 00:35:04 +01:00
sh "rm -rf node_modules/.cache/"
2024-02-08 04:11:27 +01:00
sh "rm -rf build"
end
end
desc "Produce the build/ directory"
task :build, [:buildenv] do |t, args|
2024-02-08 04:11:27 +01:00
Dir.chdir(cwd) do
buildenv = args.buildenv || ENV["buildenv"] || "development"
2024-02-08 04:11:27 +01:00
sh "rm -rf build/css/"
2024-02-16 01:21:57 +01:00
Bundler.with_unbundled_env {
sh "buildenv=#{buildenv} 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