I'm using the gulp-order module along with the event-streams module and gulp-concat to concatenate javascript files into a single dest file. The gulp-order plugin has worked great for me in other projects where I wanted to concatenate files from the stream in a distinct order. For some reason in this project it is not working properly, and the files in the public/angular/config directory are dispersed amongst the files I specify to concatenate last in the public/js directory. I think this may have something to do with specifying multiply sources ie. the angular and js directories. I tried merging the streams with the event-streams module with no luck, whereas when I first began I specified the multiple sources by passing an array to the gulp.src function
gulp.src(['./public/angular/**/*.js', './public/js/*.js'])
Below is the code I'm using now. The piping and concatenation are working fine but the order is not following the specification:
var gulp = require('gulp');
var concat = require('gulp-concat');
var notify = require('gulp-notify');
var handleErrors = require('../util/handleErrors');
var jshint = require('gulp-jshint');
var ngmin = require('gulp-ngmin');
var order = require('gulp-order');
var es = require('event-stream');
function getStream(streamPath) {
return gulp.src(streamPath);
};
gulp.task('scripts', function() {
return es.merge(getStream('./public/angular/**/*.js'),getStream('./public/js/*.js'))
.pipe(order([
'./public/angular/config/*.js',
'./public/angular/services/**/*.js',
'./public/angular/modules/**/*.js',
'./public/angular/primitives/**/*.js',
'./public/js/**/*.js'
]))
.pipe(concat('app.js'))
.pipe(gulp.dest('./public/build/js'))
.on('error', handleErrors);
});