Tutorial :Rails: App Templates / script generators with HAML?


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?


Try norman's haml-scaffold on Github.


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


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


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

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »