HTML and CSS Reference
In-Depth Information
How do you choose a minifier? CompressorRater ( )
can help. CompressorRater is a tool to rate and evaluate all of the aforementioned min‐
ification tools at one time ( Figure 4-5 ).
Figure 4-5. CompressorRater
Bringing it all together
As you've seen, there are many tools and options to choose from when minifying and
concatenating your code. Fortunately, there has been a recent community effort to bring
all of these projects together into one common build tool: it's called grunt.
More than a simple minifier, grunt ( ) is a task-based
command-line build tool for frontend projects. With it, you can concatenate files, vali‐
date files with JSHint, and minify with UglifyJS. In addition, grunt enables your project
to run headless QUnit tests with a PhantomJS instance.
grunt is available as an npm (node-packaged module), which is the nodejs way of man‐
aging installable packages ( ). If you install grunt globally with:
npm install -g grunt
it will be available for use in all of your projects. Once grunt has been installed, you can
type grunt --help at the command line for more information. Then, your available
tasks are:
Concatenate files
Generate project scaffolding from a predefined template
Validate files with JSHint
Search WWH ::

Custom Search