⚡️ Combine several JSON files into one with Gulp
MIT License
Combine several JSON files with Gulp
gulp-json-concat is a fork of gulp-jsoncombine with new few options.
$ npm install --save-dev gulp-json-concat
You can combine json files that are in subfolders. The json generated will remove the name of these folders to keep only the name of the file.
var gulp = require('gulp');
var jsonConcat = require('gulp-json-concat');
gulp.task('json', function () {
return gulp.src('db/**/*.json')
.pipe(jsonConcat('db.json',function(data){
return new Buffer(JSON.stringify(data));
}))
.pipe(gulp.dest('dist/json'));
});
Type: String
The output filename.
Type: Function
The function that will be called with the dictionary containing all the data from the processes JSON files, where the keys of the dictionary, would be the names of the files (sans the '.json' postfix).
The function should return a new Buffer
that would be writter to the output file.
MIT 2017 David Dias