gulp-normalize-pkg v0.1.2
gulp-normalize-pkg
Gulp plugin for normalize-pkg.
Install
Install with npm:
$ npm install --save gulp-normalize-pkg
Usage
var normalize = require('gulp-normalize-pkg');
var gulp = require('gulp');
gulp.task('default', function() {
return gulp.src('package.json')
.pipe(normalize())
.pipe(gulp.dest('.'))
});
Options
.match
Custom function for matching files to normalize. By default only package.json
is matched.
This gives you control over which files to match, in case you're generating files from templates or something.
Example
gulp.src('package.json')
.pipe(normalize({
match: function(file) {
return file.basename = 'foo.js';
}
}))
.fields
normalize-pkg uses a schema that has a field
for each property on the object being normalized. If a property is not recognized, normalize-pkg will just pass it through as-is.
You can use this option to add fields
to the schema. See normalize-pkg for more details.
Example
The following example adds normalizers for fields foo
and bar
:
gulp.src('package.json')
.pipe(normalize({
fields: {
foo: {
type: ['string', 'array'],
normalize: function(val, key, config, schema) {
// do stuff to val
return val;
}
},
bar: {
type: 'object',
normalize: function(val, key, config, schema) {
// do stuff to val
return val;
}
}
}
}))
Contributing
This document was generated by verb-readme-generator (a verb generator), please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Or visit the verb-readme-generator project to submit bug reports or pull requests for the readme layout template.
Building docs
Generate readme and API documentation with verb:
$ npm install -g verb verb-readme-generator && verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on June 11, 2016.