1.0.4 • Published 6 years ago

gulp-cson2 v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago