Skip to content
Run grunt tasks concurrently
Branch: master
Clone or download
Latest commit 0d76521 Aug 13, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tasks 2.3.0 Aug 5, 2016
test meta tweaks Apr 8, 2016
.editorconfig minor tweaks Feb 19, 2016
.gitattributes
.gitignore
.travis.yml minor tweaks Feb 19, 2016
gruntfile.js
license
package.json
readme.md
screenshot.png

readme.md

grunt-concurrent Build Status

Run grunt tasks concurrently


🔥 Want to strengthen your core JavaScript skills and master ES6?
I would personally recommend this awesome ES6 course by Wes Bos.


Running 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 like nodemon and watch at once.

Install

$ npm install --save-dev grunt-concurrent

Usage

require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks

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 run concurrently.
grunt.registerTask('default', ['concurrent:target1', 'concurrent:target2']);

Sequential tasks in concurrent target

grunt.initConfig({
	concurrent: {
		target: [['jshint', 'coffee'], 'sass']
	}
});

Now jshint will always be done before coffee and sass runs independent of both of them.

Options

limit

Type: number
Default: Twice the number of CPU cores with a minimum of 2

Limit how many tasks that are run concurrently.

logConcurrentOutput

Type: boolean
Default: false

You can optionally log the output of your concurrent tasks by specifying the logConcurrentOutput option. Here is an example config which runs grunt-nodemon to launch and monitor a node server and grunt-contrib-watch to watch for asset changes all in one terminal tab:

grunt.initConfig({
	concurrent: {
		target: {
			tasks: ['nodemon', 'watch'],
			options: {
				logConcurrentOutput: true
			}
		}
	}
});

grunt.loadNpmTasks('grunt-concurrent');
grunt.registerTask('default', ['concurrent:target']);

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.

License

MIT © Sindre Sorhus

You can’t perform that action at this time.