Skip to content Skip to sidebar Skip to footer

How To Compose Sequence Of Pipes For Gulp?

I have a common pattern in my gulpfile.js: var rev = require('gulp-rev'); var buffer = require('gulp-buffer'); gulp.src.some_stuff .pipe(anotherStuff) .pipe(buffe

Solution 1:

Use lazypipe:

var lazypipe = require('lazypipe');

function something(dest) {
  return (lazypipe()
   .pipe(buffer)
   .pipe(rev)
   .pipe(gulp.dest, dest)
   .pipe(rev.manifest, { path: 'manifest.json', merge: true })
   .pipe(gulp.dest, dest))();
}

gulp.src.some_stuff
  .pipe(anotherStuff)
  .pipe(something(options.dest))
  .pipe(extrastuff)

Post a Comment for "How To Compose Sequence Of Pipes For Gulp?"