Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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;

marcusellis05 commented Dec 20, 2013

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 commented Dec 20, 2013

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