[英]grunt.js - concat javascripts into function call
I'd like to concat many Javascript files into function call. 我想将许多Javascript文件合并到函数调用中。
As a result I want to get something like this: 结果,我想要得到这样的东西:
(function() {
// contents of file 1
// contents of file 2
// contents of file ..
})()
In grunt-contrib-concat package there's no such option. 在grunt-contrib-concat软件包中没有这种选择。 Also I didn't find any package for this.
我也没有找到任何包装。
Any idea how to do this? 任何想法如何做到这一点?
You can solve this issue with grunt-contrib-concat. 您可以使用grunt-contrib-concat解决此问题。 Use the banner and footer option like this:
使用横幅和页脚选项,如下所示:
concat: {
options: {
banner: '(function() {\n',
footer: '\n})()'
},
dist: {
src: ['file1.js', 'file2.js'],
dest: ''
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.