Skip to content

WayinCO/grunt-bg-shell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grunt-bg-shell

Improve your workflow by running commands in the background and in parallel using Grunt.

Getting Started

Note: 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-bg-shell --save-dev

Then add the task to your Gruntfile.js with this line:

grunt.loadNpmTasks('grunt-bg-shell');

Sample Usage

For example, say you want to run your node server and also compile coffeescript and sass/scss files all in the same terminal. You could acheive that with the following config:

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');
};

Available Options

bgShell: {
  lsTasks: {
    cmd: 'ls -la',
    execOpts: {
      cwd: './tasks'
    },
    stdout: true,
    stderr: true,
    bg: false,
    fail: false,
    done: function(){}
  }     
}
  • cmd: command to execute
  • execOpts: options for child_process.exec
  • stdout: true, false or function(out){}
  • stderr: true, false or function(err){}
  • bg: background execution
  • fail: fail grunt on error
  • done: callback after execution function(err, stdout, stderr){}

Default Options

bgShell: {
  _defaults: {
    execOpts: null,
    stdout: true,
    stderr: true,
    bg: false,
    fail: false,
    done: function (err, stdout, stderr) {
    }
  },
}

About

Better shell commands for grunt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 100.0%