$ npm install gulp-normalize-pkgGulp plugin for normalize-pkg.
Install with npm:
$ npm install --save gulp-normalize-pkg
var normalize = require('gulp-normalize-pkg');
var gulp = require('gulp');
gulp.task('default', function() {
return gulp.src('package.json')
.pipe(normalize())
.pipe(gulp.dest('.'))
});
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';
}
}))
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;
}
}
}
}))
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.
Generate readme and API documentation with verb:
$ npm install -g verb verb-readme-generator && verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on June 11, 2016.