gulp-json-concat

0.2.0 • Public • Published

gulp-json-concat

Build Status Coverage Status Dependencies Known Vulnerabilities npm module downloads per month

Combine several JSON files with Gulp

gulp-json-concat is a fork of gulp-jsoncombine with new few options.

Install

NPM

$ npm install --save-dev gulp-json-concat

Usage

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'));
});

API

jsonConcat(fileName, processor)

fileName

Type: String

The output filename.

processor

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.

Changelog

0.2.0 Update

  • Update dependencies

0.1.1 Update and corrections

  • Update dependencies
  • Fix relative path + filename on macOs (thanks to @cmandlbaur)
  • Update travis.yml, editorconfig and package.json
  • Add new badges (Coveralls, Snyk)

0.0.4 Add jsonlint

  • Analyse json files and show exactly wehre is the error

0.0.1 Initial release

  • initial code

License

MIT © 2017 David Dias

Package Sidebar

Install

npm i gulp-json-concat

Weekly Downloads

1,601

Version

0.2.0

License

MIT

Unpacked Size

6.78 kB

Total Files

4

Last publish

Collaborators

  • thedaviddias