我想将带有变量的scss文件转换为json文件。但我不知道这是否可能。有人可以给我一些提示吗?
所以我想将这种scss文件转换为json文件,变量在另一个文件中定义:
.test {
color: $test1; //#000000
}
.test1 {
color: $test2; //#ffffff
}
输出应该如下所示:
{
".test":{
"color":"#000000"
},
".test1":{
"color":"#ffffff"
}
}
答案 0 :(得分:1)
当然可以。
请检查此套餐:https://github.com/ryanbahniuk/scss-to-json
输入:
// Font Sizes
$font-size: 14px;
$font-size-large: $font-size * 1.1;
// Colors
$text-color: #666;
$text-color-light: lighten($text-color, 15%);
$border-color: #123 !global; // use for all borders
输出:
{
"$font-size": "14px",
"$font-size-large": "15.4px",
"$text-color": "#666",
"$text-color-light": "#8c8c8c",
"$border-color": "#123"
}