下面是我的Gruntfile.js
grunt.initConfig({
useminPrepare: {
html: 'Menu.htm',
options: {
dest: 'build'
}
},
usemin: {
html: ['build/Menu.html']
},
copy: {
generated: {
src: 'Menu.htm',
dest: 'build/Menu.html'
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-usemin');
grunt.registerTask('build', [
'copy:generated',
'useminPrepare',
'concat',
'cssmin',
'uglify',
'usemin'
]);
如果我运行上面的代码,我会收到错误,说“不”#34; concat"发现任务。要么我必须从registerTask中删除它,要么我必须在config中添加任务。但根据教程,我浏览了如果他们添加usemin然后concat uglify cssmin将在我运行grunt时自动添加。我为什么不自动获取?为什么我必须再次单独添加所有这些任务?