Book Image

Learning Grunt

By : Douglas Reynolds
Book Image

Learning Grunt

By: Douglas Reynolds

Overview of this book

With the increasing focus on task automation, the Grunt task runner is a vast platform that allows you to incorporate automation into your workflows. At the outset, you will learn how to use Node.js and NMP through an example. You will then find out how to build a sample app and the development environment for it. You will further delve into the implementation of Grunt plugins and the configuration of Grunt tasks. Furthermore, you will explore the various methods and packages for workflow automation. The final chapter will cover some advanced concepts, such as configuration variables and how to create a Grunt plugin. By the end of the book, you will have gained the fundamentals of Grunt and progressed through advanced concepts, including building a Grunt plugin.
Table of Contents (15 chapters)

Chapter 7. Advanced Grunt Concepts

In this chapter, we will look at an advanced Grunt concept—the creation and implementation of a custom task. In Chapter 6, Building the Sample Project we looked at how we can create custom tasks in Gruntfile.js; now, we will look at writing a task that will be implemented and used like any of the other tasks that we have been working with throughout the book. We will write a custom task that will reside in the tasks directory, create a configuration in Gruntfile.js, and load and register the custom task. For this plugin, a gzip task will be created to illustrate how you can build and implement your own tasks. You may find it very difficult to come up with a need that has not already been met with an existing plugin created to solve the same problem. Always search NPM for existing plugins. For the rare case that you are unable to find a plugin to meet your needs, this chapter will help you grasp the scope of what needs to be done.

The topic that we are going...