gulp-flat

0.1.1 • Public • Published

gulp-flat

Build Status npm version

Gulp plugin for flattening/unflattening JSON files using flat package.

Installation

npm install gulp-flat --save-dev

or

yarn add gulp-flat --dev

Usage

const gulp = require('gulp');
const flatten = require('gulp-flat');
const unflatten = require('gulp-flat').unflatten;
 
let options = {}; // optional, see flat docs for specific information
 
gulp.task('flatten-json',
    () => gulp.src('file.json')
            .pipe(flatten(options))
            .pipe(gulp.dest('dist'))
);
 
gulp.task('unflatten-json',
    () => gulp.src('file.json')
            .pipe(unflatten(options))
            .pipe(gulp.dest('dist'))
);

Options

See flat options.

Notes

Output files are indented like the original ones, unless there are no indents at all or something is wrong with them, in which case they are set to 2 spaces. Use separate plugin if you want your files minified.

Package Sidebar

Install

npm i gulp-flat

Weekly Downloads

39

Version

0.1.1

License

MIT

Unpacked Size

4.5 kB

Total Files

4

Last publish

Collaborators

  • paolostyle