Generating Sass and Haml in Rails

北城余情 提交于 2019-12-24 15:10:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!