-
Notifications
You must be signed in to change notification settings - Fork 168
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
How to ignore/negate patterns #109
Comments
Could you post the patterns that you've tried? The patterns are order dependent where the next pattern takes precedence over the previous. Also negate patterns work just like regular patterns but to the opposite effect. Which sometimes gets confusing because each pattern expands to a list of files to compare, rather than using logic on the actual patterns. |
I have tried the following:
None seemed to work. Is there a working example of this I could use to see if I'm doing something wrong? I've seen |
Well, seeing this: https://github.com/shama/gaze/blob/master/test/patterns_test.js#L30 I'm using |
I also can't use negate the pattern. This problem has already been raised, then it decided instead of using glob module fileset. 5578985. Now the module is used globule, which apparently does not support the "negate pattern" |
Turned out! // This pattern has earned: ['dir-a/**', '!dir-a/dir-b/**'] // But this pattern does not work, so he thought that no support ['dir-a/**', '!dir-a/dir-b'] |
globule does support the negate pattern and so does gaze. We both have tests for it https://github.com/cowboy/node-globule/blob/master/test/globule_test.js#L188 and https://github.com/shama/gaze/blob/master/test/patterns_test.js#L28 Consider the patterns I've even considered excluding the |
+1 for ignoring node_modules by default. My guess is that the vast majority of projects want to watch their entire source tree, and nobody (sane) wants to watch node_modules. Would be killer to be able to just pass */ and be done with it. |
This behavior is cost prohibitive in all but small and acyclic directory trees. Is there any better way to prune branches from the search tree? |
Don't include patterns that match in the first place. AFAIK, there isn't a mechanism or library that can negate patterns without first retrieving files from each and filtering. If so, please open a PR on https://github.com/cowboy/node-globule because that would be a great feature (and is the library this one uses). |
This is not a very good answer. It ignores the common situation where enumerating every specific inclusion is more onerous and error prone than enumerating every specific exclusion.
Sounds like the authors should have consulted the algorithm for find. The mechanism is very simple: do not descend into a branch of the filesystem that matches an exclusion. |
@thejohnfreeman Awesome, glad to hear it is very simple. Looking forward to your patch. :) |
I must be the only one capable. |
Couldn't Right now, you have to glob existing files yourself and add the ones that are ignored ( Chokidar has a |
Ideally, we'd want to bake this functionality into globule, so that we never even bother traversing excluded folders (basically echoing what @shama said above). The |
+1 as it would make it a bit more consistent with the As @schmod said, the initial glob would still have ran and time spent. Ideally it needs to happen in globule to be more efficient than it is now. I'll work on ignoring |
Here's a module I wrote that provides a subset of GNU find's excellent interface, including the "prune" operator. I'm happy to work with anyone who wants to use it. |
@thejohnfreeman Nice! I'll give it a try. Thanks! |
Hi,
I've not been able to use
negate
patterns even though isaacs/minimatch allow those.I want this approach because there are times I just don't want to watch changes in
node_modules
for example, but I do from any other folder/file in the project.Is there a correct way to do this with the current version of gaze?
The text was updated successfully, but these errors were encountered: