polypipe
A helper class to encapsulate stream pipes
Basic usage
In order to make piping streams more modular/recyclable, you can group them using Node modules such as stream-combiner or bun. PolyPipe is a wrapper class around stream-combiner to make the handling easier.
;;;;;; const pipe = cached 'jsFiles' newer 'build/babel' sourcemapsinit babel sourcemapswrite './' gulpdest 'build/babel' ; pipe; // Use it like a function to return the same stream as gulp.src('src/**/*.js')// .pipe(cached('jsFiles'))// .pipe(newer('build/babel'))// .pipe(sourcemaps.init())// .pipe(babel())// .pipe(sourcemaps.write('./'))// .pipe(gulp.dest('build/babel')); gulp; // Use it like a Gulp plugin and return the same stream
Chaining
PolyPipes allow for chaining with methods pipe
and prepipe
.
;;;;;; const pipe = babel ; gulp;// Does same thing as:// gulp.src('src/**/*.js')// .pipe(cached('jsFiles'))// .pipe(newer('build/babel'))// .pipe(sourcemaps.init())// .pipe(babel())// .pipe(sourcemaps.write('./'))// .pipe(gulp.dest('build/babel'));
License
polypipe is MIT licensed.
© 2016-2017 Jason Lenoble