Skip to content

Instantly share code, notes, and snippets.

@erikformella
Created February 8, 2012 21:55
Show Gist options
  • Save erikformella/1774281 to your computer and use it in GitHub Desktop.
Save erikformella/1774281 to your computer and use it in GitHub Desktop.
A rakefile for 'compiling' haml and sass. Some is custom nosense so it might need to be modified if you want to use it.
include Rake::DSL
def rebuild(relative)
puts "------ change detected in #{relative}"
if relative.pathmap("%x") == ".scss"
sh 'sass', '--no-cache', '-r', './sass/addons/bourbon/lib/bourbon.rb', relative, "../www/stylesheets/"+relative.pathmap("%n.css")
elsif relative.pathmap("%x") == ".haml"
sh 'haml', '-f', 'html5', relative, "../www/"+relative.pathmap("%n.html")
end
end
desc "Watch the site and regenerate when it changes"
task :watch do
require 'fssm'
puts ">>> Watching for Changes <<<"
FSSM.monitor("#{File.dirname(__FILE__)}", '*/*') do
update {|base, relative| rebuild(relative)}
delete {|base, relative| rebuild(relative)}
create {|base, relative| rebuild(relative)}
end
end
@erikformella
Copy link
Author

hmmm. --no-cache does not seem to prevent the cache from being created.. must investigate

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