In this recipe, we'll make use of the contrib-requirejs (0.4.4)
plugin to package the modularized source code of our web application into a single file.
For the most part, this plugin just provides a wrapper for the RequireJS tool. RequireJS provides a framework to modularize JavaScript source code and consume those modules in an orderly fashion. It also allows packaging an entire application into one file and importing only the modules that are required while keeping the module structure intact.
Tip
To see the packaged application created in this recipe in action, please refer to the sample code provided for this recipe. It includes a basic development server setup as per the Setting up a basic web server recipe in Chapter 1, Getting Started with Grunt along with the required libraries and a sample index.html
file that consumes the generated application bundle file.