O'Reilly logo

Getting Started with Grunt: The JavaScript Task Runner by Jaime Pillora

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running tasks

Up until this point, we have learnt how to configure and create tasks. Now it is time to run them!

Command-line

Some Node.js command-line tools, such as express, may also be used as a module, whereas Grunt may only be used via the command-line. Once we've globally installed the grunt-cli module, our system will have access to the grunt executable.

To run our newly loaded or created tasks, we need to provide Grunt with a list of task names as space-separated command-line arguments. This will result in Grunt executing each specified task in sequence; which means we can easily dictate the order of task execution. We could run foo then bar with:

$ grunt foo bar

Or, we run bar then foo with:

$ grunt bar foo

There is a special case, however, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required