我正在使用 Grunt-usemin。但是连接的 JS 没有被 ';' 正确分隔。如何告诉 usemin 只为 JS 文件而不是 CSS 文件添加分隔符?
目前,我的 usemin 任务如下所示:
useminPrepare: {
options: {
dest: '<%= config.dist %>'
},
html: '<%= config.app %>/index.html'
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
options: {
assetsDirs: ['<%= config.dist %>', '<%= config.dist %>/images']
},
concat: {
separator: ';'
},
html: ['<%= config.dist %>/{,*/}*.html'],
css: ['<%= config.dist %>/styles/{,*/}*.css']
},
另一个用例是将每个连接的模块包装在 IIFE 中,这需要此配置,但应仅应用于 *.js 文件:
concat: {
options: {
banner: ';(function () {',
separator: '})(); (function () {',
footer: '})();'
}
}