We are ready to deploy our site! But before we do that, we should ensure we minimize all our scripts and optimize the images, so that these pages load as quickly as possible anywhere in the world. We can automate these tasks by executing a script on the command line. Let us look at the options we have.
Once you are done with your project, you would like to generate files that strip comments and are optimized for loading quickly. There are software build systems that are typically used in software projects with similar goals. HTML5 Boilerplate's build scripts provide tasks scoped to what a typical web development project would need.
The script should be used only after you have confirmed your project is ready for deployment and it has been well tested. The build script merely automates the process of removing comments, optimizing files, and making sure the files are production ready.
There are currently two kinds of build scripts that are actively maintained by HTML5 Boilerplate contributors; these are explored in the following section.
The Ant build script is a set of files that work on top of the Apache Ant build system (ant.apache.org/
) that has been available since the early days of HTML5 Boilerplate. It offers a variety of options, described as follows:
img
folder using OptiPNG from optipng.sourceforge.net/
and JPEGTran from jpegclub.org/jpegtran/
respectivelygithub.com/jsdoc3/jsdoc
A new build script that builds on top of Node, found at nodejs.org/
, is under active development. While it is not out for production use yet, it offers a lot of tasks that are similar to the Ant build script with some new features described as follows:
img
folder using OptiPNG and JPEGTran respectivelyWatch the project files for changes, and automatically run the build script and reload open pages in browsers when they do.
Depending on what platforms you are comfortable with, you can choose one over the other. Both the build scripts are stable enough to use to deploy your production files, so your choice is down to what you are most comfortable using.
If you already have Ant installed, the Ant build script might be an obvious choice. If you find yourself using Node frequently or using it in your projects, then the Node build script could be a good start. In this chapter, we will look at using both, so you can become comfortable with either of them.