-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Not working anymore since 4.0.0 #67
Comments
There are similar issues in the closed ones: https://github.com/sindresorhus/gulp-filter/issues?q=is%3Aissue+is%3Aclosed |
I am aware, but it does not solve my issue. Is there a good reason to force using |
It is more probable that the filter was just applied for unexpected files ;). To be honest i have no idea of the implications of that change, i'm not an expert of the node-glob edge cases. Try to poke the commit author. |
@cb1kenobi could you please explain why using I saw many projects that are sticking to 3.x due to this new behavior, maybe it would be nice to be able to chose whether or not to use a path relative to |
@sinedied I wrote a decent description in the PR of the rationale behind the change: #59. I believe my change is more correct than before my change. Before my change, However, I agree there is still an issue. If the relative path resolves outside the current directory tree, then For example: var minimatch = require('minimatch');
console.log(minimatch('../bar.js', '**/*.js')); // false
console.log(minimatch('/bar.js', '**/*.js')); // true I did a quick test and said if the relative path starts with // change this:
var match = typeof pattern === 'function' ? pattern(file) :
multimatch(path.relative(file.cwd, file.path), pattern, options).length > 0;
// to this:
var match;
if (typeof pattern === 'function') {
match = pattern(file);
} else {
var relPath = path.relative(file.cwd, file.path);
if (relPath.indexOf('..') === 0) {
relPath = path.resolve(relPath);
}
match = multimatch(relPath, pattern, options).length > 0;
} This seems to work for me regardless if the input glob is absolute or relative. If you could try dropping that into your gulp-filter's Update: removed |
I tried your fix, and it effectively solves the issue. 👍 Resolving to absolute path seems dodgy though, maybe the real issue here lies with I'm not sure what's the best fix here... |
Well, well... isaacs/minimatch#30 (comment). |
Nice :) Until then, is there any workaround I could use, except for modifying directly the gulp-filter source or sticking to @3.x? |
CSS concatenation doesn't work with gulp-filter version 4.0, due to some problems with path resolution, that comes from minimatch - sindresorhus/gulp-filter#67 - isaacs/minimatch#30
I have this gulp task that works perfectly with gulp-filter@3.x:
Once I upgrade gulp-filter to 4.x, files do not get filtered anymore... I've read through the docs and I could not find any breaking change, what could I be missing?
The text was updated successfully, but these errors were encountered: