UNPKG

2.05 kBMarkdownView Raw
1# grunt-concurrent [![Build Status](https://travis-ci.org/sindresorhus/grunt-concurrent.svg?branch=master)](https://travis-ci.org/sindresorhus/grunt-concurrent)
2
3> Run grunt tasks concurrently
4
5<img src="screenshot.png" width="439">
6
7Running slow tasks like Coffee and Sass concurrently can potentially improve your build time significantly. This task is also useful if you need to run [multiple blocking tasks](#logconcurrentoutput) like `nodemon` and `watch` at once.
8
9
10## Install
11
12```sh
13$ npm install --save-dev grunt-concurrent
14```
15
16
17## Usage
18
19```js
20require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
21
22grunt.initConfig({
23 concurrent: {
24 target1: ['coffee', 'sass'],
25 target2: ['jshint', 'mocha']
26 }
27});
28
29// tasks of target1 run concurrently, after they all finished, tasks of target2 run concurrently,
30// instead of target1 and target2 run concurrently.
31grunt.registerTask('default', ['concurrent:target1', 'concurrent:target2']);
32```
33
34
35## Options
36
37### limit
38
39Type: `number`
40Default: Twice the number of CPU cores with a minimum of 2
41
42Limit how many tasks that are run concurrently.
43
44### logConcurrentOutput
45
46Type: `boolean`
47Default: `false`
48
49You can optionally log the output of your concurrent tasks by specifying the `logConcurrentOutput` option. Here is an example config which runs [grunt-nodemon](https://github.com/ChrisWren/grunt-nodemon) to launch and monitor a node server and [grunt-contrib-watch](https://github.com/gruntjs/grunt-contrib-watch) to watch for asset changes all in one terminal tab:
50
51```js
52grunt.initConfig({
53 concurrent: {
54 target: {
55 tasks: ['nodemon', 'watch'],
56 options: {
57 logConcurrentOutput: true
58 }
59 }
60 }
61});
62
63grunt.loadNpmTasks('grunt-concurrent');
64grunt.registerTask('default', ['concurrent:target']);
65```
66
67*The output will be messy when combining certain tasks. This option is best used with tasks that don't exit like `watch` and `nodemon` to monitor the output of long-running concurrent tasks.*
68
69
70## License
71
72MIT © [Sindre Sorhus](http://sindresorhus.com)