views:

43

answers:

2

I want to use haml in rails 3 project.

Now how to start? How to cofig it?

+2  A: 

Just follow the instruction on the HAML Reference page

In short:

For Rails 3, instead add the following line to the Gemfile: gem "haml"

Once it’s installed, all view files with the ".html.haml" extension will be compiled using Haml.

Matthew Manela
oh,it's auto. thanks
qichunren
A: 

You can do follow this tutorial: where you customise the generators: http://paulbarry.com/articles/2010/01/13/customizing-generators-in-rails-3

or just follow this simple way to do it original post: http://stackoverflow.com/questions/99211/how-do-i-get-haml-to-work-with-rails

First, install haml as a plugin

ruby script/plugin install git://github.com/nex3/haml.git

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

(Note: You could instead install haml as a gem, but for the sake of simplicity, let's just assume using it as a plugin is the best bet.)

Hope this helps. Thanks

PK

Pavan
Thanks very much.
qichunren
Im glad this helped you. Do mark this post as answered. So other members can use this post as a reference. ThanksPK
Pavan