luozhihua / grunt-commands

Execute commands or batch files in Grunt
Other
8 stars 5 forks source link

grunt-commands Build Status

Easy way to run shell commands, batch files or executable files in grunt.

Getting Started

This plugin requires Grunt ~0.4.0.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-commands --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-commands');

This plugin was designed to work with Grunt 0.4.x. If you're still using grunt v0.3.x it's strongly recommended that you upgrade.

Command task

Run this task with the grunt commands command.

Task targets, options may be specified according to the grunt Configuring tasks guide.

Options

force

Type: Boolean Default: true

Usage Examples

    watch: {
        // ...
    },

    // this task (grunt-commands)
    commands: {
        options: {force: false},
        target_1: {
            cmd: 'xxx.js', // detected to nodejs
        },
        target_2: {
            cmd: [
                'xxx.sh', // detected to shell
                {
                    cmd: 'xxx.bat', // detected to batch commands
                    force: true
                },
                'cd ./xxx/a' // any commands of OS supports
            ]
        }
    }

    jshint: {
        // ...
    }

Release History


Task submitted by Colin Luo

This file was generated on Fri Jul 19 2013 0:29:15.