Package Exports
- grunt-bg-shell
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (grunt-bg-shell) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
grunt-bg-shell
Better shell commands for grunt. Background/parallel run
If you want to run compass watch
, coffee --watch --output lib/ src/
and forever server.js
at the same time.
Install
$ npm i grunt-bg-shell --save-dev
Using
module.exports = function (grunt) {
grunt.initConfig({
bgShell: {
_defaults: {
bg: true
},
watchCompass: {
cmd: 'compass watch'
},
watchCoffee: {
cmd: 'coffee --watch --output lib/ src/'
},
runNode: {
cmd: 'node server.js',
bg: false
}
}
});
grunt.registerTask('default', 'bgShell:watchCompass bgShell:watchCoffee bgShell:runNode');
};
Important!
In example above all shell commands go to background. But not the last one.
We tell grunt to run till bgShell:runNode
runs
Options
bgShell: {
lsTasks: {
cmd: 'ls -la',
execOpts: {
cwd: './tasks'
},
stdout: true,
stderr: true,
bg: false,
fail: false,
done: function(){}
}
}
cmd
: command to executeexecOpts
: options forchild_process.exec
stdout
:true
,false
orfunction(out){}
stderr
:true
,false
orfunction(err){}
bg
: background executionfail
: fail grunt on errordone
: callback after executionfunction(err, stdout, stderr){}
Override defaults
bgShell: {
_defaults: {
execOpts: null,
stdout: true,
stderr: true,
bg: false,
fail: false,
done: function (err, stdout, stderr) {
}
},
}
Developing
You need to install grunt globally:
$ npm i -g grunt
- Watch coffee:
$ grunt