Skip to content

Commit

Permalink
update docs to reflect new changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yocontra committed Jun 10, 2014
1 parent 8177316 commit 0c354ef
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions docs/recipes/using-multiple-sources-in-one-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,26 @@ var gulp = require('gulp');
var merge = require('merge-stream');

gulp.task('test', function(cb) {
return merge(
gulp.src('bootstrap/js/*.js')
.pipe(gulp.dest('public/bootstrap')),
gulp.src('jquery.cookie/jquery.cookie.js')
.pipe(gulp.dest('public/jquery'))
);
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);
});
```

When streams should be emitting files in order they were added:
gulp.src will emit files in the order they were added:

```js
// npm install gulp gulp-concat streamqueue

var gulp = require('gulp');
var concat = require('gulp-concat');
var streamqueue = require('streamqueue');

gulp.task('default', function() {
return streamqueue({ objectMode: true },
gulp.src('foo/*'),
gulp.src('bar/*')
)
.pipe(concat('result.txt'))
.pipe(gulp.dest('build'));
});

// ... or ...

gulp.task('default', function() {
var stream = streamqueue({ objectMode: true });
stream.queue(gulp.src('foo/*'));
stream.queue(gulp.src('bar/*'));
return stream.done()
.pipe(concat('result.txt'))
.pipe(gulp.dest('build'));
return gulp.src(['foo/*', 'bar/*'])
.pipe(concat('result.txt'))
.pipe(gulp.dest('build'));
});
```

0 comments on commit 0c354ef

Please sign in to comment.