views:

543

answers:

4

Is there any way to create an app template in Rails that generates the views in HAML rather than ERB?

App Templates: http://railscasts.com/episodes/148-app-templates-in-rails-2-3

If not, are there any plugins/gems that I can use to have all my generator scripts output HAML instead of ERB?

+1  A: 

Try norman's haml-scaffold on Github.

Matchu
+1  A: 

Another one by Mister Bleigh http://github.com/mbleigh/haml-rails

dolzenko
A: 

if you download ryanb's nifty_generators and look at the source code, you can see that he has the following in one of his files

  if options[:haml]
    m.directory 'public/stylesheets/sass'
    m.template "layout.html.haml", "app/views/layouts/#{file_name}.html.haml"
    m.file     "stylesheet.sass",  "public/stylesheets/sass/#{file_name}.sass"
  else
    m.template "layout.html.erb", "app/views/layouts/#{file_name}.html.erb"
    m.file     "stylesheet.css",  "public/stylesheets/#{file_name}.css"
  end

This allows the user to do script/generate nifty_layout --haml

goo luck

stephenmurdoch
A: 

My favorite: http://github.com/indirect/haml-rails

Aidan Feldman