我的应用程序中有模板,它们有自己的样式表。我想让我的用户(和我自己)利用 SCSS 功能。但是,我一直无法找到如何向 Sass
gem 发送一个 SCSS 字符串,并让它返回常规 CSS。
(我也没有在google上找到它,在文档中也不好找到。)
那我该怎么做呢?
最佳答案
只是做:
# 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 .
关于ruby-on-rails - 我如何获取一串 SCSS 并让它输出 CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18110622/