Search icon CANCEL
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
Learning Grunt

You're reading from   Learning Grunt Monitor and automate complex JavaScript tasks and processes by obtaining a practical understanding of Grunt

Arrow left icon
Product type Paperback
Published in Mar 2016
Publisher Packt
ISBN-13 9781785888809
Length 184 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Douglas Reynolds Douglas Reynolds
Author Profile Icon Douglas Reynolds
Douglas Reynolds
Arrow right icon
View More author details
Toc

Gruntfile.js wrapper and configuration


Gruntfile.js implements the module pattern that injects the grunt object into its callback function. It is described as a wrapper as it effectively wraps all of the code that will make up the module. Additionally, Gruntfile.js includes all of the configuration for each plugin that is going to be included within. The following sections describe the wrapper and configuration sections of Gruntfile.js.

Wrapper

The wrapper function contains all of the Grunt-related code within its body. Recall the example from Chapter 4, Configuration of Grunt Tasks:

module.exports = function(grunt) {
  // grunt related code
};

The module.exports function encapsulates the code within to create an object with properties; in this case, we refer to it as a module. The module.exports function is set equal to a function that takes the Grunt object as its argument. Without the module.exports function or the anonymous function, which takes the grunt object as a parameter, none of the...

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 €18.99/month. Cancel anytime