Grunt plugin for executing shell commands.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-exec
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-exec');
This plugin is a multi task, meaning that grunt will automatically iterate over all exec
targets if a target is not specified.
If the command used outputs to stderr, grunt-exec will display a warning and abort grunt immediately. Grunt will continue processing tasks if the --force command-line option was specified.
- command(required): The shell command to be executed. Must be a string or a function that returns a string.
- stdout(optional): Set
true
if you want the stdout to be printed. Defaults tofalse
.
grunt.initConfig({
exec: {
remove_logs: {
command: 'rm -f *.log'
},
list_files: {
command: 'ls -l **',
stdout: true
},
echo_grunt_version: {
command: function(grunt) { return 'echo ' + grunt.version; },
stdout: true
}
}
});
Copyright (c) 2012 Jake Harding
Licensed under the MIT license.