我的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或deploy命令行参数更改dest的位置。
即如果命令行arg是dev,那么dest:'cachebuster.json' 如果命令行arg是deploy,那么dest:'src / main / resources / cachebuster.json'
我如何实现这一目标?