0
我正在使用Grunt模板,但想知道如何更新所使用的變量。請看下面的例子。Grunt模板使用的更新變量
(function() {
"use strict";
module.exports = function(grunt) {
grunt.initConfig({
directory: 'deploy', // I want to be able to update this
concat: {
options: {
separator: ';\n\n',
banner: '/*! Last edited: <%= grunt.template.today("yyyy-mm-dd") %> */\n /* DO NOT EDIT THIS FILE DIRECTLY */\n\n'
},
js_site: {
src: '<%= directory %>/assets/js/src/*.js',
dest: '<%= directory %>/assets/js/site.js',
},
js_vendor: {
src: '<%= directory %>/assets/js/vendor/*.js',
dest: '<%= directory %>/assets/js/vendor.js',
}
},
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('watch', function() {
var args = process.argv;
var dir = args[args.indexOf('--dir') + 1];
// Now update the directory variable above
});
};
})();
當我運行「咕嚕看--dir階段1」,它只是說「正在運行‘監視’任務完成,沒有錯誤。」並退出命令提示符而不是實際執行監視。知道怎麼回事? – 2015-04-02 15:05:51