同时运行 grunt 任务
nodemon 和 watch,此任务也很有用。\n\n## 安装\n```shnpm install --save-dev grunt-concurrent
\n\n## 使用\njs
require('load-grunt-tasks')(grunt);
grunt.initConfig({ concurrent: { target1: ['coffee', 'sass'], target2: ['jshint', 'mocha'] } });
// Tasks of target1 run concurrently, after they all finished, tasks of target2 run concurrently, instead of target1 and target2 running concurrently.
grunt.registerTask('default', ['concurrent:target1', 'concurrent:target2']);
\n\n## 并行目标中的顺序任务\njs
grunt.initConfig({
concurrent: {
target: [['jshint', 'coffee'], 'sass']
}
});
```\n\n现在 jshint 将始终在 coffee 和 sass 运行之前完成,无论它们是否独立运行。\n\n## 选项\n\n### limit\n类型: number\n默认值: CPU 核心数的两倍,最小值为 2\n\n限制同时运行的任务数量。\n\n### logConcurrentOutput\n类型: boolean\n默认值: false\n\n记录并行运行的输出。
您可以通过指定 logConcurrentOutput 选项可选地记录并发任务的输出。以下是一个配置示例,它使用 grunt-nodemon 启动和监控一个 Node 服务器,并使用 grunt-contrib-watch 在一个终端标签中监控资源变化:
您可以通过指定 false 来选择性地跳过并发任务的日志输出缩进。这对于在标准输出解析器中并行运行任务时很有用。
暂无开放 Issues,或尚未同步最近议题。