Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Getting Started with Grunt: The JavaScript Task Runner

You're reading from   Getting Started with Grunt: The JavaScript Task Runner If you know JavaScript you ought to know Grunt – the Task Runner for managing sophisticated web applications. From a basic understanding to constructing your own advanced Grunt tasks, this tutorial has it all covered.

Arrow left icon
Product type Paperback
Published in Feb 2014
Publisher
ISBN-13 9781783980628
Length 132 pages
Edition Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jaime Pillora Jaime Pillora
Author Profile Icon Jaime Pillora
Jaime Pillora
Bocoup LLC Bocoup LLC
Author Profile Icon Bocoup LLC
Bocoup LLC
Arrow right icon
View More author details
Toc

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, when we execute grunt on its own. Grunt interprets this as grunt default and subsequently will attempt to run the default task. Therefore, by registering a default task, we can make it easy to run our most common task. Similar to our previous example...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime