Created
September 6, 2010 01:18
-
-
Save blakesmith/566505 to your computer and use it in GitHub Desktop.
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
# Script to watch a directory for any changes to a haml file | |
# and compile it. | |
# | |
# USAGE: ruby haml_watch.rb <directory_to_watch> | |
# | |
require 'rubygems' | |
require 'fssm' | |
directory = File.join(File.dirname(__FILE__), ARGV.first) | |
FSSM.monitor(directory, '**/*.haml') do | |
update do |base, relative| | |
input = "#{base}/#{relative}" | |
output = "#{base}/#{relative.gsub!('.haml', '.html')}" | |
command = "haml #{input} #{output}" | |
%x{#{command}} | |
puts "Regenerated #{input} to #{output}" | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment