node.js - glob 匹配除顶级供应商或任何深度的 node_modules 之外的所有文件

标签 node.js glob stylelint

我正在尝试写一个 glob匹配 .css.scss 文件,但忽略 vendor 并忽略任意嵌套深度的 node_modules

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

我感觉我已经很接近了。这成功忽略了顶级 vendornode_modules,但仍然匹配嵌套的 node_modules:

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

如何将任何级别的 node_modules 调整为黑名单?

最佳答案

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

这应该忽略任何嵌套深度的vendornode_modules,包括顶层。

关于node.js - glob 匹配除顶级供应商或任何深度的 node_modules 之外的所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46966449/

相关文章:

python - 尝试使用目录和子目录中的 glob 进行排序

使用 glob 对多种文件类型进行 PHP 递归目录搜索

wordpress - 如何解决 StyleLint 中的 'property-no-unknown' 错误?

css - 如何使 stylelint 防止嵌套 block 中最后一个大括号后出现空行?

javascript - Async.waterfall 的 native 回调函数

node.js - Google Cloud Endpoints 客户端库 NodeJS

node.js - Node/Mocha 测试超时

java - Spring Reactive Router Path - 带排除的通配符

javascript - 关于 mongoose 查询的 tailable cursor 的错误

css - css模块的自定义格式化规则