Thursday, October 24, 2013

HAML to ERB

Convert Haml to ERB

http://makandracards.com/makandra/544-convert-haml-to-erb

There are plenty of tools for converting from ERB to HAML. I'm not ready to drink the kool aid, even though HAML has been around forever and there seems to be a great following.

script/plugin install http://github.com/cgoddard/haml2erb.git

hamls = Dir["app/views/**/*.haml"] - ['app/views/layouts/screen.html.haml'];
hamls.each do |haml| 
  puts haml
  erb = haml.sub(/\.haml$/, '.erb')
  File.open(erb, 'w') do |file| 
    file.write Haml2Erb.convert(File.read(haml)) 
  end
end

No comments: