Is there a way to use variables from my Ruby application inside a Sass file?
有办法在Sass文件中使用来自Ruby应用程序的变量吗?
1 个解决方案
#1
26
You can add .erb extention to your .sass file and then add your variables just like in regular .erb file:
您可以将.erb扩展添加到.sass文件中,然后像普通的.erb文件一样添加变量:
<%= APP_CONFIG[:yourkey] %>
More information:
更多信息:
- http://guides.rubyonrails.org/asset_pipeline.html#preprocessing
- http://guides.rubyonrails.org/asset_pipeline.html预处理
- http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
- 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
- http://rwilcox.tumblr.com/post/9038701675/sass-variables-and-the-rails-3-1-asset-pipeline
#1
26
You can add .erb extention to your .sass file and then add your variables just like in regular .erb file:
您可以将.erb扩展添加到.sass文件中,然后像普通的.erb文件一样添加变量:
<%= APP_CONFIG[:yourkey] %>
More information:
更多信息:
- http://guides.rubyonrails.org/asset_pipeline.html#preprocessing
- http://guides.rubyonrails.org/asset_pipeline.html预处理
- http://guides.rubyonrails.org/asset_pipeline.html#coding-links-to-assets
- 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
- http://rwilcox.tumblr.com/post/9038701675/sass-variables-and-the-rails-3-1-asset-pipeline