如何使用 WebStorm 将选项传递给 Grunt 任务?

How to pass an option to a Grunt task using WebStorm?

我的项目中有一个Gruntfile.js,由WebStorm解析(JetBrains IDE for Javascript)。已解析的任务出现在 G运行t 视图中。

正在考虑以下任务(参见 http://gruntjs.com/frequently-asked-questions#options):

grunt.registerTask('upload', 'Upload code to specified target.', function(n) {
  var target = grunt.option('target');
  // do something useful with target here
});

我如何运行 grunt upload --target=staging 使用 WebStorm?我找不到传递选项的方法。

要指定传递给 Grunt 任务的自定义 CMD 选项(通过 grunt.option() 检索),请使用 Grunt 运行 配置的任务字段,例如:'print -–echo=Hello'(或' upload --target=staging' 在你的情况下)