gulp-cson2

1.0.4 • Public • Published

gulp-cson2

Inspired by gulp-cson, but written in js.

  • It delays the extname modification to the next event loop so gulp-watch's callback could print files with their original 'cson' extname.
  • It has a standard error handling, so it works great with gulp-plumber.
  • It uses cson-parser directly instead of using cson package, so it is smaller than gulp-cson

Usage

Install

npm i -D gulp-cson2

Example

// you can use it without watch & plumber for sure
const gulp = require('gulp')
const watch = require('gulp-watch')
const plumber = require('gulp-plumber')
const cson = require('gulp-cson2')
 
function compileCSON() {
  return watch(
    './hello.cson',
    { ignoreInitial: false },
    f => console.log(f.event, f.relative)
  )
    .pipe(plumber())
    // indent is 2 by default. it's directly passed to JSON.stringify's third argument
    .pipe(cson({ indent: 2 }))
    .pipe(gulp.dest('dist'))
}
 
gulp.task('default', compileCSON)

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i gulp-cson2

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

4.11 kB

Total Files

8

Last publish

Collaborators

  • donaldshen