@absolunet/json-to-scss 中文文档教程
@absolunet/json-to-scss
Convert a JSON to a SCSS map
Install
$ npm install @absolunet/json-to-scss
Usage
const jsonToScss = require('@absolunet/json-to-scss');
console.log(
jsonToScss.convert(`
{
"points": [
[0, 1.2],
[50, 1.6],
[200, 1.8]
],
"dimension": {
"small": 600,
"medium": 900,
"large": 1200,
"xlarge": 1500
},
"transition": {
"hover": 100,
"animation": 500
},
"color": {
"shell": {
"main": "#659d32",
"shade": "#618931"
},
"fruit": "#423228"
}
}
`)
);
/*
$points: (
0 1.2,
50 1.6,
200 1.8
);
$dimension: (
'small': 600,
'medium': 900,
'large': 1200,
'xlarge': 1500
);
$transition: (
'hover': 100,
'animation': 500
);
$color: (
'shell': (
'main': #659d32,
'shade': #618931
),
'fruit': #423228
);
*/
API
convert(data [, indent])
Converts JSON to SCSS map
返回 String
SCSS
data
必需
类型:字符串
JSON 内容
indent
类型:String
默认值:
缩进样式
Source
License
MIT © 绝对网
@absolunet/json-to-scss
Convert a JSON to a SCSS map
Install
$ npm install @absolunet/json-to-scss
Usage
const jsonToScss = require('@absolunet/json-to-scss');
console.log(
jsonToScss.convert(`
{
"points": [
[0, 1.2],
[50, 1.6],
[200, 1.8]
],
"dimension": {
"small": 600,
"medium": 900,
"large": 1200,
"xlarge": 1500
},
"transition": {
"hover": 100,
"animation": 500
},
"color": {
"shell": {
"main": "#659d32",
"shade": "#618931"
},
"fruit": "#423228"
}
}
`)
);
/*
$points: (
0 1.2,
50 1.6,
200 1.8
);
$dimension: (
'small': 600,
'medium': 900,
'large': 1200,
'xlarge': 1500
);
$transition: (
'hover': 100,
'animation': 500
);
$color: (
'shell': (
'main': #659d32,
'shade': #618931
),
'fruit': #423228
);
*/
API
convert(data [, indent])
Converts JSON to SCSS map
Return String
SCSS
data
Required
Type: String
JSON content
indent
Type: String
Default: <tab>
Indent style
Source
Forked from razwan/json-to-sass-map
License
MIT © Absolunet
更多