[英]Node glob pattern for every .js file except .spec.js
I am looking for a better glob pattern for usemin, i want to to find all .js
files but exclude the .spec.js
files. 我正在为usemin寻找更好的glob模式,我想找到所有
.js
文件,但不包括.spec.js
文件。 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. 我现在的解决方案要求我不断添加文件扩展名以排除它们,否则它们会被拾取,例如
.html
文件。
I tried to make it only look for .js
files and exclude the .spec.js
from them but it does not seem to work. 我试图让它只查找
.js
文件并.spec.js
排除.spec.js
但它似乎不起作用。
Also adding a !components/**/*.spec.js
as another script below does not seem to work. 另外在下面添加一个
!components/**/*.spec.js
作为另一个脚本似乎不起作用。
这个glob包括所有*.js
但不包括*.spec.js
:
components/**/!(*.spec).js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.