Skip to content

Instantly share code, notes, and snippets.

@rogeruiz
Created May 17, 2012 17:32
Show Gist options
  • Select an option

  • Save rogeruiz/2720418 to your computer and use it in GitHub Desktop.

Select an option

Save rogeruiz/2720418 to your computer and use it in GitHub Desktop.
Let's watch some Haml
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