除.spec.js外,每个.js文件都采用节点glob模式

时间:2023-02-09 19:52:23

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.

我正在为usemin寻找更好的glob模式,我想找到所有的.js文件,但是排除.spec。js文件。到目前为止,我有以下的解决方案。

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

< script src = "组件/ * * / *(. js | !(* .spec.js | * .scss))" > < /脚本>

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来自他们,但似乎并不起作用。

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

也添加一个! / * * / * .spec组件。作为下面的另一个脚本,js似乎不起作用。

1 个解决方案

#1


89  

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

这个glob包括了所有的*。js但不是* .spec.js:

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

#1


89  

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

这个glob包括了所有的*。js但不是* .spec.js:

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