-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't exclude directories using src glob #165
Comments
so |
You're globbing for files, if you want to ignore the dir you need to: |
@sindresorhus No dice. Now the |
Just an update: I updated to gulp 3.4.0 and am still having the same issue. |
@aaronbushnell can you create a repo so we can clone it and work on the same dir structure? :) |
The way I've made this work is to exclude the directory and the contents like so: |
@gfloyd Hm, doing that still copied over the |
gulp.src(['app/**', '!app/{_tmp,_tmp/**}']) why?
using the
:-) |
seems like that it is not clear - maybe we should create a recipe with that? /cc @contra |
@stryju That worked perfectly! Thanks for the help. Will this be simplified in the future or should I plan on always writing exclusions like this? |
more of a question @ https://github.com/isaacs/minimatch :-) issue resolved? ;-) |
Resolved. I'll bring the issue there. Thanks, all! |
happy to help :) |
It can be golfed further to |
Does not work for me:
I'm still getting a populated vendor directory. |
@chovy You have a space there that messes things up: |
|
I want to match everything except bower_components and anything inside. return gulp.src([
'src/*',
'!src/**/*.html',
'!src/bower_components{,/**}'
] Any suggestions? |
@alexpi this pattern will include the folders containing the html files, but should exclude the html files themselves - is that the case? |
Sorry! There was no issue after all, another Gulp task was the culprit. The code works as expected. |
Thanks to gfloyd, that solution works. |
Thank you, @ktstowell, your solution worked really well. I'm working with Gulp Zip. It was really cumbersome to exclude a few folders/files and keep everything else including the project tree as it is. @stryju Thank you for your solution of using Here's my code: var gulp = require( 'gulp' ),
zip = require( 'gulp-zip' );
gulp.task( 'zip', function() {
return gulp.src( [
'!{.gitignore,sftp-config.json}',
'!node_modules', '!node_modules/**',
'!dist', '!dist/**',
'!assets/bower_components', '!assets/bower_components/**',
'./**',
] )
.pipe( zip('archive.zip') )
.pipe( gulp.dest( 'dist' ) );
}); |
This works well for me: gulp.src(['app/**', '!app/_tmp{,/**/*}']) |
Just as a note, I used to use:
But then converting it to:
Shaved off at least 3 whole seconds from my task. |
I was calling a folder above and copying all it's content expect from the folder I was currently inside(called "deploy"). This worked for me - |
Read through this thread and tried a bunch of things but still directories are copying over. I want to exclude ALL of /src but src/images/sub-directory ends up getting copied albeit empty.
I end up with:
Using gulp babel. Any ideas? |
There is one line solution. It is great when glob need to be apply relative:
It import:
Don't import:
So it basically work as one level directory exclude.
Important: It won't work if added AFTER "**". |
I can't exclude a directory from being copied over when using a src glob. Here's my task:
Gulp copies over
app/**
, butapp/_tmp/
is still being copied.Expected:
Gulp output:
Update: Clarified that the
dist/_tmp/
directory does not contain any filesThe text was updated successfully, but these errors were encountered: