Created
January 11, 2015 18:00
-
-
Save mbildner/b904c09515089d37135b to your computer and use it in GitHub Desktop.
merge gulp streams *IN ORDER*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint node: true */ | |
'use strict'; | |
var gulp = require('gulp'); | |
var mainBowerFiles = require('main-bower-files'); | |
var concat = require('gulp-concat'); | |
var merge = require('gulp-merge'); | |
gulp.task('all', function () { | |
var bower = gulp.src(mainBowerFiles()); | |
var app = gulp.src(['app.js']); | |
return merge(bower, app) | |
.pipe(concat('all.js')) | |
.pipe(gulp.dest('dist')); | |
}); | |
gulp.task('default', ['all']); |
I'm having this issue now. Did you find a solution in the end?
@mkstix6 I solved this issue by using gulp-order. In this gist example you'd need gulp-rename as well:
'use strict';
var gulp = require('gulp');
var mainBowerFiles = require('main-bower-files');
var rename = require('gulp-rename');
var merge = require('gulp-merge');
var order = require('gulp-order');
var concat = require('gulp-concat');
gulp.task('all', function () {
var bower = gulp.src(mainBowerFiles()).pipe(rename('vendor.js'));
var app = gulp.src(['app.js']);
return merge(bower, app)
.pipe(order('vendor.js', 'app.js')
.pipe(concat('all.js'))
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['all']);
I use this technique to merge css from vendors and my own
Hope it helps
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
merge-stream
isn't giving me streams in a deterministic order... not sure why