ryanve
ryanve

Reputation: 52581

glob to match all files except top-level vendor or any-depth node_modules

I'm trying to write a glob to match .css or .scss files but ignore vendor and ignore node_modules at any nesting depth.

vendor/please-ignore.css
vendor/example/please-ignore.css
node_modules/any/please-ignore.css
other/please-match.css
other/example/please-match.css
other/node_modules/please-ignore.css
other/example/node_modules/please-ignore.css
another/please-match.css
another/example/please-match.css
another/node_modules/please-ignore.css
another/example/node_modules/please-ignore.css

I feel like I'm close. This successfully ignores top-level vendor and node_modules but still matches nested node_modules:

stylelint './!(vendor|node_modules)/**/*.?(s)css'

How can I adjust to blacklist node_modules at any level?

Upvotes: 2

Views: 3684

Answers (1)

jeddy3
jeddy3

Reputation: 3959

Try stylelint '**/!(vendor|node_modules)/*.?(s)css'

This should ignore vendor and node_modules at any nesting depth, including the top level.

Upvotes: 2

Related Questions