I have the following task:
var inject = require('gulp-inject');
...
gulp.task('index-build', function () {
return gulp.src(config.index)
.pipe(
inject(gulp.src(config.build + '/vendor/**/*.js', { read: false }))
)
.pipe(gulp.dest(config.build));
});
Mostly this does what it's supposed to: concatenate files in alphabetic order within the paths, resulting in something like:
...
<script src="/vendor/angular/angular.js"></script>
<script src="/vendor/angular-resource/angular-resource.js"></script>
...
but sometimes, irregularly, it does this:
...
<script src="/vendor/angular-resource/angular-resource.js"></script>
<script src="/vendor/angular/angular.js"></script>
...
Which breaks the app since angular-resource.js
depends on angular.js
.
Why does gulp do this unpredictably and how do I assure that the order is the same each time?