Register a production task:
// on the dev server, only concat
grunt.registerTask('default', ['concat']);
// on production, concat and minify
grunt.registerTask('prod', ['concat', 'min']);
On your dev server run grunt
and on your production run grunt prod
.
You can setup finer grain targets per task as well:
grunt.initConfig({
min: {
dev: {
// dev server minify config
},
prod: {
// production server minify config
}
}
});
grunt.registerTask('default', ['min:dev']);
grunt.registerTask('prod', ['min:prod']);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…