-
-
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
Support multiple globs and negation for .src() #7
Comments
If it is going to take an array or string as src, then I think ignore should be the negated glob like grunt: gulp.files(["./css/vendor/*.css", "!./css/app/*.css"]) ref #6 |
@phated Ignore will be in an option as the second argument like '.src(glob, {ignore: glob})'. Your main glob and ignore glob should also support arrays. I'm open to grunt style but I might need some convincing because I never saw the point |
If it is implemented with node-glob, the negate syntax should already work, as per https://github.com/isaacs/node-glob#comparisons-to-other-fnmatchglob-implementations |
@phated Yeah it will probably support both. I want an alternate for people who don't want to learn globs past * and **. |
/cc @robrich |
I dug into minimatch and node-glob quite a bit yesterday. It supports "!./.js" but not "{./.js,!./node_modules/}" making it pretty much useless. Grunt wraps node-glob in processPatterns() which flattens the results, specifically checks for globs that start with ! and manually handles them differently. All else being equal, I'd like to fix node-glob and/or minimatch, but @contra suggested starting over as both libraries are not very well tested nor maintained. Perhaps one of the dozen node-glob wrappers / work-a-likes already does this? |
@robrich - Really the glob module does three things
Only the regex generation needs to be split out and we can use existing crawlers and fs watchers for the other step |
Pinging here. ATM the globbing impl cripples the expected behavior of several plugins with regards to globbed ignores, smart renaming and directory structure replication (another issue?). Perhaps replicating grunt's globbing interface is the best route, though I personally don't mind the |
FYI for anyone currently having problems with this you can pipe multiple .src() calls into eachother to hold you over. For negation you can use the gulp-ignore plugin. This fix is taking longer than expected due to some tricky edge cases. |
FINALLY finished in 3.0 |
|
@Jakobud it does, please read the docs. You can pass multiple positive or negative globs |
Where in the docs? https://github.com/gulpjs/gulp/blob/master/docs/API.md Am I missing something? |
@Jakobud Please reference https://github.com/wearefractal/vinyl-fs#srcglobs-opt |
Uh... okay I'm not sure what that has to do with gulp documentation or how I would have ever found that page.... but anyways, I still don't see anything on there about ignoring an array of paths when using |
Okay I think I figured it out. I didn't see this anywhere in the gulp docs, but I could just do a array of globs like this:
|
I'll take a PR to make the docs better if you feel they are inadequate - they should probably include all of the info vinyl-fs docs do |
Should work like this
or
The text was updated successfully, but these errors were encountered: