私のうなり声の初心者を許してください。私は 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
、uglify タスクと imagemin タスクの両方が何も処理 (および出力) しません。もう一度起動すると、すべて正常に動作します。「一時」フォルダーを手動で削除して再起動するとgrunt
、uglify と imagemin は再び何もしません。
私が間違っていることを見つけるのを手伝ってください。ノードはバージョン 0.8.2、gruntcli 0.1.6、grunt 0.4.0 です。
読んでくれてありがとう