Is there a way to use variables from my Ruby application inside a Sass file?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can add .erb extention to your .sass file and then add your variables just like in regular .erb file:
<%= APP_CONFIG[:yourkey] %>
More information:
- http://guides.rubyonrails.org/asset_pipeline.html#preprocessing
- http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
- http://rwilcox.tumblr.com/post/9038701675/sass-variables-and-the-rails-3-1-asset-pipeline
标签: