gulp-multi-extend
![Dependency Status](https://david-dm.org/sulake/gulp-multi-extend.svg)
A gulp plugin to extend JSON contents with a separate JSON file. Uses node.extend plugin for extend.
Usage
var gulp = require('gulp');
var extend = require('gulp-multi-extend');
var path = require('path');
gulp.src('./files/to/extend/*.json')
.pipe(extend('./file/to/extend/with.json'))
.pipe(gulp.dest('./dist'));
function processJSON(srcFilePath, contents) {
var basename = path.basename(srcFilePath, path.extname(srcFilePath));
return contents[basename];
}
gulp.src('./files/to/extend/*.json')
.pipe(extend('./file/to/extend/with.json', processJSON))
.pipe(gulp.dest('./dist'));
API
extend(filePath[, processFn [, jsonSpace]])
filePath
Type: String
The JSON file to extend other files with
processFn
Type: Function(srcFilePath, contents)
Default: undefined
Params:
srcFilePath
- The file path given from gulp.src
contents
- The JSON contents of the file given to extend in filePath
jsonSpace
Type: String
or Number
Default: undefined
Number of spaces used for pretty printing JSON.
License
MIT License