Skip to content

Instantly share code, notes, and snippets.

@marcusellis05
Last active December 31, 2015 21:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusellis05/8050184 to your computer and use it in GitHub Desktop.
Save marcusellis05/8050184 to your computer and use it in GitHub Desktop.
Simple Node script for calling Grunt tasks without the CLI
var grunt = require('grunt')
, args = process.argv.slice(2)
, tasks = ['build'];
if (args && args.length){
tasks = args;
}
grunt.cli.tasks = tasks;
grunt.cli();
@marcusellis05
Copy link
Author

save this as "build.js" in the root folder of your project (with your "gruntfile.js"). then you call call any of your tasks or aliases but doing something like:

node build cssmin

or to call multiple tasks at once:

node build less concat cssmin

@marcusellis05
Copy link
Author

the default task is "build", so calling:

node build

with no arguments will run the "build" alias. if you don't have an alias named "build", you may want to change line 5 of this script accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment