我的应用程序中有模板,它们有自己的样式表。我想让我的用户(和我自己)利用SCSS功能。但是,我还没有找到如何向Sass
gem发送一串SCSS,并让它返回常规CSS。
(我也无法在谷歌上找到它,也不容易在文档中找到它。)
那我该怎么办?
答案 0 :(得分: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"
请参阅此处的Sass参考文档:http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html。