javascript - Utilising the output of two previous gulp streams -


i take result of css processing step getcss, , js processing step getjs, use these 2 results create file named index.html, result of inlining processed css , processed js template named index-template.html.

can me better understand how can achieve this?

this have far...

gulp.task('build', function() {     eventstream.merge(getcss.bind(gulp), getjs.bind(gulp))         .pipe(inlinejsandcss.bind(gulp)); });  function getcss() {     return this.src(options.lessglob)         .pipe(less())         .pipe(minifycss()); }  function getjs() {     return this.src(options.jsglob)         .pipe(uglify()); }  function inlinejsandcss() {     // take css , js generated      // previous steps , inline them      // index-template.html     //...     .pipe(this.dest('index.html')); } 

edit: storing result of intermediate steps in memory, , creating stream this, canonical way achieve this?

https://github.com/gulpjs/gulp/blob/master/docs/recipes/make-stream-from-buffer.md

using eventstream.merge not required.

simply output result of css , js processing steps region of memory visible final step, , configure gulp dependencies accordingly.

something so:

const sharedmemory = {}; gulp.task('css', partial(getcss, sharedmemory)); gulp.task('js', partial(getjs, sharedmemory)); gulp.task('inline', ['css', 'js'], partial(inline, sharedmemory)); gulp.task('build', ['replace']); gulp.task('default', ['build']); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -