请原谅我咕噜noobiness。 我有grunt 0.4正确安装并正常工作,我很喜欢它。咕噜似乎跳过一些任务在第一次运行
但我不明白,为什么我的默认任务总是跳过一些子任务,第一次。
这里的Gruntfile的相关部分:
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
main: {
files: [
{src: ['src/**'], dest: 'temp/'} // includes files in path and its subdirs
]
}
},
uglify: {
main: {
files: grunt.file.expandMapping(['temp/**/*.js', '!temp/**/*min.js'], './')
}
},
imagemin: {
main: {
files: grunt.file.expandMapping(['temp/**/*.png', 'temp/**/*.jpg'], './')
}
},
compress: {
main: {
options: {
archive: 'archive.zip'
},
files: [
{expand: true, cwd: 'temp/src/', src: ['**'], dest: './'} // makes all src relative to cwd
]
}
},
clean: ["temp", "archive.zip"]
});
// Load the plugins
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-clean');
// Default task(s).
grunt.registerTask('default', ['clean', 'copy', 'uglify', 'imagemin', 'compress']);
grunt.registerTask('test', ['clean', 'copy', 'uglify']);
论grunt
第一次运行,既丑化和imagemin任务不处理(输出)任何东西。如果我再次启动它一切正常。如果我手动删除“temp”文件夹并重新启动,则uglify和imagemin不会再执行任何操作。
请帮我找到我做错了什么。 节点是0.8.2版本,gruntcli 0.1.6,0.4.0咕噜
感谢您阅读
更新:它总是在第一次运行时发生,并且可能在其他场合随机(很少)发生。这看起来像是异步处理的问题。 – Greg 2013-03-02 06:41:00