问题
Does the current head of Rails not come with haml generators? (I know in Rails 2 you had to add a generator plugin.) Setting config.generators.template_engine = :haml doesn't work. Also, how do I switch from generating .scss to generating .sass? Setting config.generators.template_engine = :sass didn't work. I get error haml/sass [not found]. I have both installed and in my Gemfile.
回答1:
In 3.0, there is no haml nor sass/scss support, you need to place them in your gemfile, and call bundler. But you will get no generators even with these gems, you should use something with theese if you realy want that.
And with rails 3.1, sass/scss is part of the framework.
回答2:
I'm not sure about Sass (although I'd recommend using scss over sass files) - but with Haml, all you need to do is have the haml gem listed in your Gemfile, and have haml
instead of erb
in your view file names. For example: index.html.haml
- and that should just work.
来源:https://stackoverflow.com/questions/6399780/generating-sass-and-haml-in-rails