在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):rbalicki2/gulp-json-sass开源软件地址(OpenSource Url):https://github.com/rbalicki2/gulp-json-sass开源编程语言(OpenSource Language):JavaScript 100.0%开源软件介绍(OpenSource Introduction):Gulp-json-sass
Issues should be reported on the issue tracker. This JSON file can also be read by your Javascript. This will make it easier to keep your JS code used for layout and your CSS code in sync. Supports all JSON objects, including nested objects, arrays and keys which are not legal key names (variable names that begin with a number will be prefixed; variable names containing illegal characters will have those characters escaped.) Ignores (passes through) files with a extensions other than Installationnpm install --save gulp-json-sass ExampleIn this example gulpfile, a JSON file is turned into a file of sass variables, concatenated with a sass file, and compiled using var jsonSass = require('gulp-json-sass'),
gulp = require('gulp'),
concat = require('gulp-concat'),
sass = require('gulp-ruby-sass');
gulp.task('sass', function() {
return gulp
.src(['example.json', 'example.sass'])
.pipe(jsonSass({
sass: true
}))
.pipe(concat('output.sass'))
.pipe(sass())
.pipe(gulp.dest('out/'));
}); APIjsonSass(options)Returns: optionsType: delimType: String used to delimit nested objects. For example, if {
"someObject" : {
"someKey" : 123
}
} will be converted into (in scss mode): $someObject-someKey: 123; Note that keys can contain the delimiter. No attempt is made to ensure that variable names are unique. SassType: If truthy, output valid sass variables. If false, output scss variables. ignoreJsonErrorsType: If true, malformed JSON does not result in the plugin emitting an error. escapeIllegalCharactersType: If true, escapes illegal characters in variable names with a backslash ( The following characters are escaped: prefixFirstNumericCharacterType: If true, top-level keys that begin with a number will be prefixed with {
"1maca" : {
"2maca" : "asdf"
},
"3maca" : "rena"
} Will result in, in scss mode, with $_1maca-2maca: asdf;
$_3maca: rena; firstCharacterType: What string to use to prefix numeric top-level keys. LicenseMIT. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论