【发布时间】:2019-01-16 10:47:00
【问题描述】:
我的 ruby 代码中有一个指南针样式字符串。我想把它转换成一个css字符串。我有 config.rb 的值作为哈希值。
如何通过函数调用将字符串格式的指南针转换为css(字符串)?
【问题讨论】:
标签: ruby sass compass-sass
我的 ruby 代码中有一个指南针样式字符串。我想把它转换成一个css字符串。我有 config.rb 的值作为哈希值。
如何通过函数调用将字符串格式的指南针转换为css(字符串)?
【问题讨论】:
标签: ruby sass compass-sass
是的,你可以做到:
require 'sass'
scss_string = '@mixin test{width: auto}; div {@include test}'
print Sass::compile(scss_string)
这将输出:
div {
width: auto; }
Here you have the link to the ruby doc for this method, with information about how to customize it.
【讨论】:
darken($color, 10%),该怎么办?使用Sass.compile 会导致导入错误,因为它不知道指南针。