简体   繁体   中英

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

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."

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM