UNPKG

1.9 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
29grunt.registerTask('default', ['concurrent:target1', 'concurrent:target2']);
30```
31
32
33## Options
34
35### limit
36
37Type: `number`
38Default: Twice the number of CPU cores with a minimum of 2
39
40Limit how many tasks that are run concurrently.
41
42### logConcurrentOutput
43
44Type: `boolean`
45Default: `false`
46
47You 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:
48
49```js
50grunt.initConfig({
51 concurrent: {
52 target: {
53 tasks: ['nodemon', 'watch'],
54 options: {
55 logConcurrentOutput: true
56 }
57 }
58 }
59});
60
61grunt.loadNpmTasks('grunt-concurrent');
62grunt.registerTask('default', ['concurrent:target']);
63```
64
65*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.*
66
67
68## License
69
70MIT © [Sindre Sorhus](http://sindresorhus.com)