Socket
Socket
Sign inDemoInstall

gulp-multi-extend

Package Overview
Dependencies
59
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-multi-extend

A gulp plugin to extend multiple JSON files


Version published
Weekly downloads
751
increased by119.59%
Maintainers
1
Install size
856 kB
Created
Weekly downloads
 

Readme

Source

gulp-multi-extend

Build Status Dependency Status

A gulp plugin to extend JSON contents with a separate JSON file. Uses node.extend plugin for extend.

Usage

var gulp = require('gulp');
var extend = require('gulp-multi-extend');
var path = require('path');

// Extend JSON files in ./files/to/extend/ folder
// with contents of ./file/to/extend/with.json
// and output files into ./dist folder
gulp.src('./files/to/extend/*.json')
  .pipe(extend('./file/to/extend/with.json'))
  .pipe(gulp.dest('./dist'));
  
// Process with.json file with processJSON function
function processJSON(srcFilePath, contents) {
  var basename = path.basename(srcFilePath, path.extname(srcFilePath));
  // e.g. /path/to/files/to/extend/en.json -> en
  return contents[basename];
}

gulp.src('./files/to/extend/*.json')
  .pipe(extend('./file/to/extend/with.json', processJSON))
  .pipe(gulp.dest('./dist'));

API

extend(filePath[, processFn [, jsonSpace]])

filePath

Type: String

The JSON file to extend other files with

processFn

Type: Function(srcFilePath, contents)

Default: undefined

Params:

  • srcFilePath - The file path given from gulp.src
  • contents - The JSON contents of the file given to extend in filePath
jsonSpace

Type: String or Number

Default: undefined

Number of spaces used for pretty printing JSON.

License

MIT License

Keywords

FAQs

Last updated on 26 Jun 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc