Chapter 2. Composing build tasks and flows

 

This chapter covers

  • Understanding what should happen in a build
  • Learning about key build tasks
  • Using Grunt to run key tasks
  • Configuring a build flow using Grunt
  • Creating your own Grunt tasks

In the previous chapter you got a quick overview of what the Build First approach looks like, and you glanced at a lint task. In this chapter, we’ll go over common build tasks and a few more advanced ones. I’ll uncover the use cases and reasoning behind each of them, and we’ll look at how to implement them in Grunt. Learning the theory might sound dull, but it’s particularly important if you use a task runner other than Grunt, as I’m sure you will eventually.

Grunt is a configuration-driven build tool that helps set up complex tasks easily—if you know what you’re doing. Using Grunt, you’ll compose workflows, such as those I described in chapter 1, which could be tuned for development productivity or optimized for releases. Similarly, Grunt helps with deployment procedures, which you’ll analyze in chapter 4.

2.1. Introducing Grunt

2.2. Preprocessing and static asset optimization

2.3. Setting up code integrity

2.4. Writing your first build task

2.5. Case study: database tasks

2.6. Summary