It's not a bug, the documentation is just wrong. The newest version of gulp is gulp@3.9.1
which uses vinyl-fs@0.3.14
. The behavior you're referring to wasn't introduced until vinyl-fs@1.0.0
.
In fact, elsewhere the gulp docs explicitly state that glob ordering will be a new feature in gulp@4.0.0
:
globs passed to gulp.src will be evaluated in order, which means this is possible gulp.src(['*.js', '!b*.js', 'bad.js'])
(exclude every JS file that starts with a b
except bad.js)
That means you could simply use to the current development version of gulp (gulpjs/gulp#4.0
) and take advantage of the new feature. Note however that gulp 4.x is radically different from gulp 3.x when it comes to defining tasks.
One workaround would be to keep using gulp 3.x for tasks definitions, but use the newest version of vinyl-fs
to create vinyl streams:
var vinylFs = require('vinyl-fs');
gulp.task('copy', function() {
return vinylFs.src(['client/*.js', '!client/b*.js', 'client/bad.js'])
.pipe(vinylFs.dest('public'));
});
And if you don't want to do that you can always use merge-stream
to combine multiple streams into one stream:
var merge = require('merge-stream');
gulp.task('copy', function() {
return merge(gulp.src(['client/*.js', '!client/b*.js']),
gulp.src(['client/bad.js']))
.pipe(gulp.dest('public'));
});