gulp-community / gulp-concat

Streaming concat middleware for gulp
MIT License
792 stars 127 forks source link

Won't concat files in certain order #68

Closed nathanhornby closed 9 years ago

nathanhornby commented 9 years ago

(On latest version)

I'm seeing an odd issue where files declared in one order will be concatenated successfully, but not in a different order. Annoyingly the order that works in this case is the wrong order for my needs.

This works:

gulp.task('plugins', function() {
    return gulp.src(['js/compiled/scripts.min.js','plugins/*.js'])
        .pipe(concat('all.min.js'))
        .pipe(gulp.dest('dist'));
});

This doesn't:

gulp.task('plugins', function() {
    return gulp.src(['plugins/*.js','js/compiled/scripts.min.js'])
        .pipe(concat('all.min.js'))
        .pipe(gulp.dest('dist'));
});

No errors.

scripts.min.js lints just fine, but does have a long sourcemap added to the end of it after linting.

Edit: Updating to add that removing the sourcemap doesn't have any effect.

Editing to clarify: 'Doesn't work', by this I actually mean that the second example will result in all.min.js only containing the single file currently in plugins/. i.e. it doesn't combine the files from those two locations. In the first example, it successfully concat's the files as you'd expect.

yocontra commented 9 years ago

Hmm that's weird. This is more of an issue on gulp.src, can you open something on vinyl-fs? I don't think there are any tests regarding file ordering.

yairEO commented 9 years ago

This a huge bug in the newest gulp version! very annoying. I I wrote an issue here - https://github.com/gulpjs/gulp/issues/687

Hope they answer quickly! Any order with wildcard returns random stream (using gulp src)