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
First, install haml as a gem in bundler by adding this to your Gemfile
:
gem "haml"
Run bundle install
, then make sure your views are named with a *.html.haml extension. For example:
`-- app
`-- views
|-- layouts
| `-- application.html.haml
`-- users
|-- edit.html.haml
|-- index.html.haml
|-- new.html.haml
`-- show.html.haml
Add haml to your Gemfile:
gem "haml"
If you want to use the scaffold-functions too, add haml-rails within your development-group:
gem 'haml-rails', :group => :development
Don't forget to run:
$ bundle install
For Rails 3 all you need to do is add gem "haml", '3.0.25'
to your Gemfile
. No need to install plugin or run haml --rails .
.
Just:
$ cd awesome-rails-3-app.git $ echo 'gem "haml"' >> Gemfile
And you're done.
First, make sure you have the HAML gem.
gem list --local | grep haml
If haml doesn't show up in the list, then do this:
sudo gem install haml
Then do this from your project directory:
# cd ../
# haml --rails <yourproject>
That should install everything you need, and the HAML views should stop complaining and parse correctly.