Closed lddubeau closed 8 years ago
THANK YOU!!!! This finally fixed the problem's I'd been having trying to use this plugin, and was very confused why a single *
would work, since both glob patterns didn't match the rest of gulp's glob styles.
Perfect! This fix my issue as well. The documentation should be updated.
:+1:
I agree, submitting a PR would help to clean it quicker.
Hah! One lousy asterisk caused my problem and it took me several hours to figure it out. Thank you, @lddubeau, for posting this issue. It helped me solve a problem that was driving me crazy.
The "Usage" section on the npm page still shows the example with a single asterisk: https://www.npmjs.com/package/gulp-filter#filter-only
const f = filter(['*', '!src/vendor']);
I'm referring to this
The intent seems to process everything in
src
but to exclude the files insrc/vendor
. Problems:src/*.js
won't go into subdirectories in the first place. You could remove the filter and you'd still not get anything fromsrc/vendor
intodest
.src/**/*.js
then this pattern will cover every.js
file insrc
, including subdirectories but the filter still gives the wrong impression. It does the work of excluding files insrc/vendor
not because of!src/vendor
but because of*
, which matches only files that are not in a subdirectory. You could reduce the filter togulpFilter('*')
and it would still excludesrc/vendor
and everything in it.**
instead of*
, then the filter no longer works because!src/vendor
does not match anything. Why? Becausegulp-filter
matches against the file's relative path.Ultimately, the code I see doing what the example seems to be illustrating should be:
The examples based off of this one should also be fixed.