Programmatically set options for grunt task?

前端 未结 6 1270
旧时难觅i
旧时难觅i 2021-02-07 07:52

I have a grunt task that looks at options with grunt.option(\'foo\'). If I\'m calling this task from grunt.task.run(\'my-task\'), how can I change thos

6条回答
  •  旧时难觅i
    2021-02-07 08:51

    Create a new task which set the option, then call the modified task. This is a real life example with assemble:

    grunt.registerTask('build_prod', 'Build with production options', function () {
      grunt.config.set('assemble.options.production', true);
      grunt.task.run('build');
    });
    

提交回复
热议问题