Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

haml vs haml-rails

In order to have rails generators create the views with haml i'm coming across two answers and both seem to work. which is better?

Option1: declare 'haml' in the gemfile and do

  config.generators do |g|
    g.template_engine :haml
  end

Option2: just declare 'haml-rails' in the gemfile

like image 803
AdamT Avatar asked Dec 27 '22 12:12

AdamT


2 Answers

According to the description on the haml-rails github. It is just an integration of Haml for rails. So if you like easy go with the haml-rails gem

"Haml-rails provides Haml generators for Rails 3. It also enables Haml as the templating engine for you, so you don't have to screw around in your own application.rb when your Gemfile already clearly indicated what templating engine you have installed. Hurrah."

like image 178
Rasmus Avatar answered Jan 10 '23 08:01

Rasmus


Option 2 because Option 1 does not work. Declaring "haml" in your Gemfile does not give you the ability to set the default template_engine to :haml in your application.rb.

The haml-rails gem includes the generators, so that is the recommended option.

like image 21
vanboom Avatar answered Jan 10 '23 10:01

vanboom