I am trying to get Haml to work with my Ruby on Rails project. I am new to Ruby on Rails and I really like it. However, when I attempt to add an aplication.html.haml
Before trying to use haml in your rails application, you can verify that the command line executable is installed correctly:
$ haml
%p
%span Hello World!
Then press CTRL-D and you should see:
<p>
<span>Hello World!</span>
</p>
if for some reason you installed haml, but you haml doesn't start. try
sudo ln haml /usr/bin/
in the bin directory of your haml gem
for some reason this didn't happen automatically on my ubuntu 9.04 Jaunty.
make sure to add haml
gem into your Gemfile
This may be an old question but I think the answer is using haml-rails at https://github.com/indirect/haml-rails
The answers above are spot-on. You just need to put gem 'haml'
in your Gemfile
.
One other tip that was not mentioned: to have rails generators use haml
instead of erb
, add the following to config/application.rb
:
config.generators do |g|
g.template_engine :haml
# you can also specify a different test framework or ORM here
# g.test_framework :rspec
# g.orm :mongoid
end
If you are using Pow you will need to restart it also. Ideally you are using powder (gem install powder), because then you can just run this at the terminal
$ powder restart