Rails3 and Sass::Plugin::options

丶灬走出姿态 提交于 2020-01-03 12:58:33

问题


When I try to add Sass::Plugin.options[:style] = :compact to environment.rb

When I try to start up my server I get:

uninitialized constant Sass (NameError)

I have added gem 'haml', '3.0.0' to my Gemfile.

Anybody ran into this?


回答1:


I tried what you described and it worked fine for me. I'm using haml 3.0.4 which is the latest version. You may want to run a gem update haml on your system and try again. The list of changes from 3.0.0 to 3.0.4 are at http://sass-lang.com/docs/yardoc/file.SASS_CHANGELOG.html

I also suggest not putting this in your environment.rb, but instead create a config/initializers/sass_config.rb file and put your SASS config there. Mine looks like this:

Sass::Plugin.options[:property_syntax] = :old
Sass::Plugin.remove_template_location("./public/stylesheets/sass")
Sass::Plugin.add_template_location("./app/stylesheets")



回答2:


I had the exact same problem, and using the sass_config.rb file worked for my case - it seems the calls in environment.rb are occurring before the plugin init.rb is loaded.



来源:https://stackoverflow.com/questions/2807214/rails3-and-sasspluginoptions

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