0
我正在構建Grunt插件,並且需要選擇Gruntfile.js
中的一個目標。獲取Grunt插件的目標
Gruntfile.js:
grunt.initConfig({
plugin: {
options: {},
target: {} // <= This is what I want to select
}
});
裏面的任務/ plugin.js我可以使用options = this.options()
得到options
對象,但我不能只用this.target
。有什麼想法嗎?
我使用'console.log(this.args [0])'這給了我'undefined'和'console.log(this .args.length)'給我'0'。 – jasonetco
你用來運行任務的命令 – theaccordance
'grunt.registerTask('default',['plugin']);'< - 那個。我猜你會說要運行'plugin:target',但那不是我想要做的。 – jasonetco