I have a situation where I need a single glob pattern (that uses minimatch
) to match all JavaScript files which are not in a certain directory. Unfortunately, I'm using another tool that doesn't expose any options (like an ignore
glob), so it has to be a single glob to do the job.
Example input (it should not match the top, but it should match the bottom):
docs/foo/thing.js
docs/thing.js
client/docs/foo/thing.js
client/docs/thing.js
src/foo/thing.js
src/thing.js
docs-src/foo/thing.js
docs-src/thing.js
client/docs-src/foo/thing.js
client/docs-src/thing.js
And here's what I have for the glob pattern so far:
**/!(docs)/*.js
With that I'm matching docs/foo/thing.js
and client/docs/foo/thing.js
and not matching docs-src/thing.js
or client/docs-src/thing.js
. If I switch my glob to **/!(docs)/**/*.js
then I can match client/docs-src/thing.js
, but I also match client/docs/thing.js
.
I'm not certain this is possible so I may need to find another solution for my problem :-/