Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
gulp-json-sass
Advanced tools
Gulp plugin for turning JSON files into files of scss/sass variable definitions.
Gulp plugin for turning JSON files into files of scss/sass variable definitions.
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 .json
.
npm install --save gulp-json-sass
In this example gulpfile, a JSON file is turned into a file of sass variables, concatenated with a sass file, and compiled using gulp-ruby-sass
.
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/'));
});
Returns: stream
Type: object
Type: string
Default: -
String used to delimit nested objects. For example, if delim
is '-'
, then
{
"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.
Type: boolean
Default: false
If truthy, output valid sass variables. If false, output scss variables.
Type: boolean
Default: false
If true, malformed JSON does not result in the plugin emitting an error.
Type: boolean
Default: true
If true, escapes illegal characters in variable names with a backslash (\
). See http://stackoverflow.com/questions/17191265/legal-characters-for-sass-and-scss-variable-names
The following characters are escaped: !"#$%&'()*+,./:;<=>?@[]^{|}~
and white space.
Type: boolean
Default: true
If true, top-level keys that begin with a number will be prefixed with options.firstCharacter
, but not keys of nested objects. For example,
{
"1maca" : {
"2maca" : "asdf"
},
"3maca" : "rena"
}
Will result in, in scss mode, with options.firstCharacter
and options.delim
left as the defaults:
$_1maca-2maca: asdf;
$_3maca: rena;
Type: string
Default: _
What string to use to prefix numeric top-level keys.
MIT.
FAQs
Gulp plugin for turning JSON files into files of scss/sass variable definitions.
The npm package gulp-json-sass receives a total of 124 weekly downloads. As such, gulp-json-sass popularity was classified as not popular.
We found that gulp-json-sass demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.