Skip to content

Instantly share code, notes, and snippets.

@adamesque
Created January 14, 2011 20:01
Show Gist options
  • Save adamesque/780139 to your computer and use it in GitHub Desktop.
Save adamesque/780139 to your computer and use it in GitHub Desktop.
Custom nanoc Rakefile
require 'nanoc3/tasks'
require 'rubygems'
def rebuild_site(relative)
begin
puts ">>> Change Detected to: #{relative} >> Update Complete "
sh 'nanoc co'
rescue StandardError => e
puts e
end
end
desc "Watch the site and regenerate when it changes"
task :watch do
require 'em-dir-watcher'
puts ">>> Watching for Changes <<<"
EM.run {
EMDirWatcher.watch File.dirname(__FILE__),
:include_only => ['Rules', '/content', '/layouts', '/lib'],
:grace_period => 0.2 do |paths|
rebuild_site paths
end
}
end
desc "Completely empty /output"
task :clobber do
sh "rm -rf output/* output/.[Dh]*"
end
@adamesque
Copy link
Author

This is my custom Rakefile for use with nanoc. Features include:

  • Custom watch task so that I don't have to use adsf to serve sites during development. (I prefer apache2 and virtual hosts)
  • Clobber task to unequivocally wipe /output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment