Reputation: 1051
I have a situation where I need to pull files from numerous folders through a pipeline of tasks ultimately resulting in a single file.
Suppose I have two different types of sources, source type A and B. "A" sources need to be uglified/minified, while B sources do not (they already are.) Ultimately, I want both A and B to be concatenated together. How can this be achieved with gulp and gulp plugins?
var aSources = gulp.src(...)
.pipe(uglify());
var bSources = gulp.src(...);
return ?????.pipe(concat(...)).pipe(gulp.dest(...));
I've tried using the event-stream plugin to merge the two streams: this causes the "a" stream to be replayed on the merge, so the result is the a stream in duplicate.
Upvotes: 1
Views: 163
Reputation: 628
You can use "merge-stream"
mergeStream([streamA, streamB]).pipe(concat(...))...
Or "gulp-if":
gulp.src([sources])
.pipe(gulpIf(/[.]js$/, uglify))
.pipe(concat(...))
Or "gulp-add-src":
gulp.src(source1).pipe(uglify()).pipe(gulAddSrc(source2))
Upvotes: 2