First, install gulp-extend
as a development dependency:
npm install gulp-extend --save-dev
Then, add it to your gulpfile.js
:
Extend the contents of json files
var extend = require('gulp-extend');
gulp.src('./src/*.en.json')
.pipe(extend('text.en.json'))
.pipe(gulp.dest('./dist'));
Extend the contents of a json file and then wrap them in a code block
var extend = require('gulp-extend');
var wrap = require('gulp-wrap');
gulp.src('./src/*.json')
.pipe(extend('text.en.js') //use .js extension since we plan to wrap
.pipe(wrap('angular.module(\'text\', []).value(<%= contents %>);'))
.pipe(gulp.dest("./dist"));
Type: String
The output filename
Type: Boolean
Default: true
If the extend should be deep.
Type: String
or Number
Default: undefined
JSON.stringify's space attribute for pretty-printing the resulting JSON.
See MDN docs on JSON.stringify() for more information.