Convert all erb's to haml's in rails
#!/usr/bin/env ruby class ToHaml def initialize(path) @path = path end def convert! Dir["#{@path}/**/*.erb"].each do |file| `html2haml -rx #{file} #{file.gsub(/\.erb$/, '.haml')}` `rm #{file}` end end end path = File.join(ARGV[0]) ToHaml.new(path).convert!
run the file with "ruby hamlit directory"
e.g. ruby hamlit app/views
Warning, this will trash your .erb files, if for some reason you want them hanging around.