gulp-extend

0.3.0 • Public • Published

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

Dependents (9)

Package Sidebar

Install

npm i gulp-extend

Weekly Downloads

906

Version

0.3.0

License

none

Unpacked Size

104 kB

Total Files

15

Last publish

Collaborators

  • adamayres