[英]Grunt Configuration Issue
I have a grunt task to concatenate all js files in to one.The configurations is like below. 我有一个艰巨的任务将所有js文件合并为一个。配置如下。
concat:{
options: {
separator: ';'
},
dist:{
src:['src/**/*.js'],
dest: 'dist/<%= pkg.name %>.js'
}
}
The problem is that it is concatenating the test files also which is not required. 问题是它也串联了测试文件,这不是必需的。 The test files are having names like "*Spec.js".
测试文件的名称类似于“ * Spec.js”。 For example I am having a js file like test.js, then its test file will be like testSpec.js.
例如,我有一个像test.js这样的js文件,那么它的测试文件将像testSpec.js。 How Can i exclude them while concatenating the js files?
连接js文件时如何排除它们?
Since all your test files have prefix "test", you can ignore files using ! 由于所有测试文件都带有前缀“ test”,因此您可以使用!忽略文件。 (negate):
(否定):
// All files except for bar.js, in alpha order:
{src: ['foo/*.js', '!foo/bar.js'], dest: ...}
So your code should be like: 因此,您的代码应类似于:
concat:{
options: {
separator: ';'
},
dist:{
src:['src/**/*.js', '!src/**/test*.js'],
dest: 'dist/<%= pkg.name %>.js'
}
}
This will ignore all the files which has a prefix "test". 这将忽略所有带有前缀“ test”的文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.