If I have the files
client/
a.js
bob.js
bad.js
And the gulp task
gulp.task('copy', function() {
return gulp.src(['client/*.js', '!client/b*.js', 'client/bad.js'])
.pipe(gulp.dest('public'));
});
then according to the documentation we should copy a.js
and bad.js
. However, when I run this with gulp v3.9.1, it only copies a.js
.
Is this a known bug? Is there a way to do this?
It's not a bug, the documentation is just wrong. The newest version of gulp is
[email protected]
which uses[email protected]
. The behavior you're referring to wasn't introduced until[email protected]
.In fact, elsewhere the gulp docs explicitly state that glob ordering will be a new feature in
[email protected]
: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:And if you don't want to do that you can always use
merge-stream
to combine multiple streams into one stream: