Created
February 8, 2012 21:55
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hmmm. --no-cache does not seem to prevent the cache from being created.. must investigate