0

我正在创建一个自定义的 grunt 任务:

grunt.registerTask('my-task', 'Do something', function() {

从这个任务内部,我希望运行一个 grunts 复制任务,每次传递不同的目的地。

如何从我的自定义任务中运行任务,每次都传递不同的变量?

4

1 回答 1

1

如果您正在编写自定义任务,则可以利用 grunt 公开的 API。您可以使用在自定义任务中运行任务grunt.task.run();

function myCustomTask(grunt) {
  grunt.log.ok('This is my custom task.');
  grunt.task.run('copy');
}

grunt.registerTask('my-task', 'Do something', myCustomTask);

您可以通过阅读此API 文档了解有关在自定义任务中运行任务的更多信息

于 2016-04-12T14:37:30.293 回答