From d5992fa4e9e207700b6c737b341fb88e4114ebbc Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Tue, 25 Jul 2023 15:32:57 -0300 Subject: [PATCH] Add tasks/nanoc.rake --- Rakefile.rb | 30 +----------------------------- tasks/nanoc.rake | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 tasks/nanoc.rake diff --git a/Rakefile.rb b/Rakefile.rb index 19e9f1c71..cdc0b9918 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -8,35 +8,7 @@ require "yaml" # Rake tasks load "tasks/deploy.rake" load "tasks/linter.rake" - -build_dir = Ryo.from(YAML.load_file("./nanoc.yaml")).output_dir -namespace :nanoc do - task :compile do - ENV["SASS_PATH"] = "./src/css/" - sh "bundle exec nanoc co" - end - - task :clean do - sh "rm -rf #{build_dir}" - end - - task watch: [:compile] do - require "listen" - Listen.to File.join(Dir.getwd, "src"), force_polling: true do - sh "rake build" - end.start - sleep - end -end - -desc "Build the website" -task build: "nanoc:compile" - -desc "Trigger a build when src/ is modified" -task "build:watch" => "nanoc:watch" - -desc "Clean the build directory" -task clean: "nanoc:clean" +load "tasks/nanoc.rake" desc "Serve the website on localhost" task :server do diff --git a/tasks/nanoc.rake b/tasks/nanoc.rake new file mode 100644 index 000000000..0c5ba4f4c --- /dev/null +++ b/tasks/nanoc.rake @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +build_dir = Ryo.from(YAML.load_file("./nanoc.yaml")).output_dir +namespace :nanoc do + task :compile do + ENV["SASS_PATH"] = "./src/css/" + sh "bundle exec nanoc co" + end + + task :clean do + sh "rm -rf #{build_dir}" + end + + task watch: [:compile] do + require "listen" + Listen.to File.join(Dir.getwd, "src"), force_polling: true do + sh "rake build" + end.start + sleep + end +end + +desc "Build the website" +task build: "nanoc:compile" + +desc "Trigger a build when src/ is modified" +task "build:watch" => "nanoc:watch" + +desc "Clean the build directory" +task clean: "nanoc:clean"