0
我Gruntfile.js是一樣的東西:如何使用咕嚕目標
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
grunt.config.set('targ', grunt.option('target'));
cachebuster: {
build: {
options: {
basedir: 'WebContent',
formatter: function(hashes) {
var json = {};
for (var filename in hashes) {
json["/" + filename] = hashes[filename];
}
return JSON.stringify(json);
}
},
src: [ 'WebContent/assets/**/*.js', 'WebContent/assets/**/*.css' ],
dest: 'src/main/resources/cachebusters.json'
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-cachebuster');
// Default task.
grunt.registerTask('default', ['cachebuster']);
};
我想基於dev的改變dest的位置或部署命令行參數..
即,如果命令行arg是dev的則dest:「cachebuster.json」 如果命令行參數是部署然後dest:'src/main/resources/cachebuster.json'
我該如何做到這一點?
謝謝。您描述的在目標間共享選項的第二種方法效果很好。 –