gulpjs/gulp

Better document using ordered-read-stream to handle multiple streams being returned

Open

#1.269 aberto em 21 de set. de 2015

Ver no GitHub
 (8 comments) (0 reactions) (0 assignees)JavaScript (4.166 forks)batch import
documentationgulp4help wanted

Métricas do repositório

Stars
 (32.979 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

A really commonly asked question, and one of the recipes, is how to return multiple streams in one task. The answer is to use merge-stream, of course, but would it be easier for users / cut down the number of support questions if merge-stream were a dependency of gulp and returning an array of streams called it automatically?

So this:

var gulp = require('gulp');
var merge = require('merge-stream');

gulp.task('test', function() {
  var bootstrap = gulp.src('bootstrap/js/*.js')
    .pipe(gulp.dest('public/bootstrap'));

  var jquery = gulp.src('jquery.cookie/jquery.cookie.js')
    .pipe(gulp.dest('public/jquery'));

  return merge(bootstrap, jquery);
});

Would turn into this:

var gulp = require('gulp');

gulp.task('test', function() {
  var bootstrap = gulp.src('bootstrap/js/*.js')
    .pipe(gulp.dest('public/bootstrap'));

  var jquery = gulp.src('jquery.cookie/jquery.cookie.js')
    .pipe(gulp.dest('public/jquery'));

  return [bootstrap, jquery];
});

It's pretty much the same, but a lot simpler to someone who doesn't understand streams or nodejs. Also, really easy to implement.

Thoughts?

Guia do colaborador