question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better document using merge-stream to handle multiple streams being returned

See original GitHub issue

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?

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
phatedcommented, Sep 21, 2015

👎 on introducing magic into core. People need to learn their tools, including streams and node, if they are using gulp. This is just a documentation issue.

0reactions
phatedcommented, May 31, 2016

Yep!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I merge multiple Streams into a higher level Stream?
You can use StreamZip in package:async to combine two streams ... Stream<C> merge(Stream<A> streamA, Stream<B> streamB) { return streamA .
Read more >
How to merge many streams into one stream using Confluent
In this tutorial, learn how to merge many streams into one stream using Confluent, with step-by-step instructions and examples.
Read more >
Merging down and copying up between streams - Perforce
When you double-click a stream in the Stream graph, a pop-up displays copy and merge information, along with links to the Merge/Integrate and...
Read more >
merge-stream - npm Package Health Analysis - Snyk
Create a stream that emits events from multiple other streams For more information about how to use this package see README.
Read more >
merge-stream | Yarn - Package Manager
Create a stream that emits events from multiple other streams ... new Stream(); var merged = mergeStream(stream1, stream2); var stream3 = new Stream(); ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found