Closed chopfitzroy closed 9 years ago
@robrich Nothing working. @CrashyBang did you got any solution.
It's not working at all for me either. I'm not sure what I could be doing wrong. It seems like it should be very straightforward. Here is my code:
return gulp.src('./public/**/*')
.pipe(gulpIgnore.exclude('./public/favicon.ico'))
.pipe(gulp.dest('./build'));
This should be copying all of the public
directory to the build
directory but it should be excluding the favicon.ico
file. But it does not work at all. What am I doing wrong?
I can now see the key point in the documentation, but it took a while to sink in. You need to use the vinyl-fs object for your conditions.
So for file name comparison you need to use the path item of the vinyl-fs object. Taking the example from the last comment something like this should work:
return gulp.src('./public/**/*')
.pipe(gulpIgnore.exclude(function(file) {
if (file.path.indexOf('public/favicon.ico') > 0)
return true;
}))
.pipe(gulp.dest('./build'));
Not working here, nothing being excluded. I want to exclude a particular folder from the src, not a single file, so the vinyl object is no good to me
Stephen,
Do you have an example gulpfile on GitHub or pastebin that shows this behavior?
Not any longer, I went with another solution
@stevematdavies what solution did you go with ?
As the README says, you can pass in anything that works with gulp-match
, so it should work if you pass in something like this : .pipe(gulpIgnore.exclude(/public\/favicon\.ico/))
Same issue here. End up using gulp-filter
: https://www.npmjs.com/package/gulp-filter (which also required few tries and errors, though)
Globs are pretty finiky. @CrashyBang: change your exclude glob to 'src/includes/**'
or 'src/includes/**/*.html'
to ensure it matches. As you wrote it, the glob believes inclues
is a file, not a folder. Want to PR to improve the glob docs?
In my Gulpfile I have the following Task:
I am using gulp-ignore to exclude the
includes
directory however it is not working and includes all ways ends up in thedist
folder.I assume I have set the variable right:
so this is the line I am having trouble with:
Anyone come across something similar?
Full Gulpfile.