gulp-less-json-variables
v1.0.4
Published
A Gulp plugin for generate less variables file from JSON file
Downloads
219
Maintainers
Readme
gulp-less-json-variables
Gulp write less variables from JSON
A simple plugin for Gulp. This module write on source file, specified less variables from JSON config file.
Installation
The easiest way is to keep gulp-less-json-variables
as a devDependency in your package.json
.
{
"devDependencies": {
"gulp": "^3.9.0",
"gulp-less-json-variables": "1.0.0"
}
}
You can simple do it by:
npm install gulp-less-json-variables --save-dev
API
plugin(json)
Write on input file with the given variables from json
and
returns a transform stream for use in your gulp pipeline.
Usage
Create a JSON config file like this:
{
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
}
this file contains the coupled key value representing less variables.
var gulp = require('gulp'),
lessVars = require('gulp-less-json-variables'),
jsonVars = require('variables.json');
gulp.task('generate less variables', function() {
return gulp.src('less/variables.js')
.pipe(lessVars(jsonVars))
.pipe(gulp.dest('dist'));
});
Contributing
In line of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using gulp.
Release History
27/08/2015 - v1.0.4 - Fix variable row generation with the character ":" instead of "=".
License
Licensed under the MIT license.