Automatically convert HAML views to ERB via the Haml2Erb Gem.

Adapted from Guard-HAML at


As the gem name suggests this is a guard extension. Make sure you get guard first.

You will also need a copy of Haml2Erb, which can be obtained here:

Simply add it to your Gemfile:

gem 'haml2erb', :git=>''

Now, Install the gem:

gem install guard-haml2erb

Add it to your Gemfile if you're using bundler (you should)

gem 'guard-haml2erb'

Add a basic guard setup:

guard init haml2erb


If you want to change the output directory use the output option in your Guardfile, e.g.:

guard 'haml2erb', :output => 'public' do
  watch %r{^src/.+(\.html\.haml)}

This output is relative to the Guardfile.

If you maintain your haml files in a directory that should not be part of the output path, you can set the input option, e.g.:

guard 'haml2erb', :output => 'public', :input => 'src' do
  watch %r{^src/.+(\.html\.haml)}

So when you edit a file src/partials/_partial.html.haml it will be outputted in public/partials/_partial.html without the src.


Pull requests are welcome. Specs are very welcome, make sure you support both ruby 1.8.7 and ruby 1.9.2.