Ran*_*llB 4 ruby ruby-on-rails sass
我的应用程序中有模板有自己的样式表.我想让我的用户(和我自己)利用SCSS功能.但是,我还没有找到如何向Sassgem 发送一串SCSS,并让它返回常规CSS.
(我也无法在谷歌上找到它,也不容易在文档中找到它.)
那我该怎么做?
Jac*_*own 11
做就是了:
# your SCSS string
str = %Q{
$text-color: #555555;
$unfocused-background-color: #f1f0ec;
body {
background: $unfocused-background-color;
color: $text-color;
}
}
se = Sass::Engine.new(str, :syntax => :scss)
se.render
# => "body {\n background: #f1f0ec;\n color: #555555; }\n"
Run Code Online (Sandbox Code Playgroud)
请参阅此处的Sass参考文档:http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html.
| 归档时间: |
|
| 查看次数: |
409 次 |
| 最近记录: |