dolphins7.skeleton/rake/tasks/nanoc.rake
0x1eef 2e8cf6e333 Drop 'twenty-' prefix from toplevel directories
The directories twenty-{server,client,cli} have been renamed to
not include 'twenty-'. The gems are still published with the twenty-
prefix, otherwise a collision is impossible to avoid. This commit makes
it slightly easier to generalize twenty.
2024-04-21 20:11:25 -03:00

44 lines
1.1 KiB
Ruby

namespace :nanoc do
require "bundler/setup"
workdir = File.realpath File.join(__dir__, "..", "..", "client")
desc "Clean the build/ directory"
task :clean do
Dir.chdir(workdir) do
sh "rm -rf node_modules/.cache/"
sh "rm -rf build"
end
end
desc "Configure build environment"
task :env do
ENV['SASS_PATH'] = File.join(workdir, 'src', 'css', 'vendor', 'tail.css', 'src')
end
desc "Produce the build/ directory"
task :build, [:buildenv] => %w[nanoc:env] do |t, args|
Dir.chdir(workdir) do
buildenv = args.buildenv || ENV["buildenv"] || "development"
sasspath = ENV["SASS_PATH"]
sh "rm -rf build/css/"
Bundler.with_unbundled_env {
sh "SASS_PATH=#{sasspath} buildenv=#{buildenv} bundle exec nanoc co"
}
end
end
desc "Produce the build/ directory on-demand"
task watch: %w[nanoc:build] do
Dir.chdir(workdir) 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