[Ruby on Rails] "erb2haml" for Converting erb to haml

Tadashi Shigeoka ·  Sat, April 7, 2012

In Ruby on Rails, when converting from erb files to haml files, the erb2haml gem is convenient and recommended.

# Gemfile:
group :development do
  gem 'erb2haml'
end

The following command converts all erb files to haml files.

$ rake haml:convert_erbs
Looking for ERB files to convert to Haml...
Converting: app/views/layouts/application.html.erb... Done!

By the way, the original erb files remain after conversion, so delete them when they’re no longer needed.

That’s all from the Gemba.

【Reference】

Converting erb to haml in Rails - komagata