Node glob pattern for every .js file except .spec.js

本秂侑毒 提交于 2019-12-03 03:25:56

问题


I am looking for a better glob pattern for usemin, i want to to find all .js files but exclude the .spec.js files. I have the following solution so far.

<script src="components/**/*(.js|!(*.spec.js|*.scss))"></script>

The solution i have at the moment requires me to keep adding file extensions to exclude them, else they get picked up, for example .html files.

I tried to make it only look for .js files and exclude the .spec.js from them but it does not seem to work.

Also adding a !components/**/*.spec.js as another script below does not seem to work.


回答1:


This glob includes all *.js but not *.spec.js:

components/**/!(*.spec).js


来源:https://stackoverflow.com/questions/26639236/node-glob-pattern-for-every-js-file-except-spec-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!