grunt-concurrentdep

Run grunt tasks concurrently by depend

Usage no npm install needed!

<script type="module">
  import gruntConcurrentdep from 'https://cdn.skypack.dev/grunt-concurrentdep';
</script>

README

grunt-concurrentdep

Build Status Dependency Status devDependency Status

NPM

Run grunt tasks concurrently by depends

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-concurrentdep

Usage

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

grunt.initConfig({
    concurrentdep: {
        app: {
            concat: ['csslint','jshint'],
            cssmin: ['concat'],
            csslint: ['preprocess'],
            jshint: ['preprocess'],
            uglify: ['concat'],
            phplint: []
        }
    }
});

grunt.registerTask( "default",['concurrentdep']);
                        ┌ csslint ┐        ┌ uglify ┐
run:       ┌ preprocess ┤         ├ concat ┤        ├┐
     start ┤            └ jshint ─┘        └ cssmin ┘├ done
           └ phplint ────────────────────────────────┘

Options

limit

Type: number
Default: 4

Limit how many tasks that are run concurrently.

showDuration

Type: boolean
Default: true

You can optionally show taskduration

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({
    concurrentdep: {
        options: {
            logConcurrentOutput: true
        },
        app: {
            ...
        }
    }
});

grunt.loadNpmTasks('grunt-concurrentdep');
grunt.registerTask('default', ['concurrentdep:app']);

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.

Based on grunt-concurrent