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(buffer()) // this line & 4 lines down
.pipe(rev())
.pipe(gulp.dest(options.dest))
.pipe(rev.manifest({ path: 'manifest.json', merge: true }))
.pipe(gulp.dest(options.dest)) // to this
.pipe(extrastuff)
I want to compose these 5 lines to reuse them in my project over a couple of gulp tasks. How can I do that?
I found multipipe package but it doesn't support passing variables to new pipes (you can see I need to pass options.dest
in my new pipe).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…