Rails3 和 Sass::Plugin::options
当我尝试将 Sass::Plugin.options[:style] = :compact
添加到environment.rb
时,当我尝试启动服务器时,我得到:
未初始化的常量 Sass (NameError)
我已将 gem 'haml', '3.0.0'
添加到我的 Gemfile 中。
有人遇到过这个吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我尝试了你所描述的方法,它对我来说效果很好。我使用的是 haml 3.0.4,这是最新版本。您可能需要在系统上运行
gem update haml
,然后重试。从 3.0.0 到 3.0.4 的更改列表位于 http:// sass-lang.com/docs/yardoc/file.SASS_CHANGELOG.html我还建议不要将其放入您的environment.rb中,而是创建一个
config/initializers/sass_config.rb
文件并将你的 SASS 配置放在那里。我的看起来像这样: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.htmlI 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_config.rb 文件适用于我的情况 - 似乎在加载插件 init.rb 之前发生了environment.rb 中的调用。
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.