A gulp plugin to extend (merge) json contents
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.editorconfig
.gitattributes
.gitignore
.jshintrc
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

gulp-extend NPM version Build Status Dependency Status

A gulp plugin to extend (merge) json contents

Usage

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"));

API

extend(fileName[, deep [, jsonSpace]])

fileName

Type: String

The output filename

deep

Type: Boolean
Default: true

If the extend should be deep.

jsonSpace

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.

License

MIT License