HTML and CSS Reference
as small as possible is becoming more important to ensuring faster load times and more
enjoyable user experiences. Minification is the process of removing all unnecessary
characters from source code, without changing its functionality.
erably reducing their file size. Some libraries also merge multiple script files into a single
file for client download. This fosters a modular approach to development and limits
Google has released its Closure Compiler tool, which provides minification as well as
the ability to introduce more aggressive renaming. It also can remove dead code and
provide function inlining. In addition, certain online tools, such as Microsoft Ajax
Minifier, the Yahoo! YUI Compressor, and Pretty Diff, can compress CSS files. Some of
your choices are:
JSMin is a conservative compressor, written several years ago by Douglas Crockford.
files. It typically reduces file size by half, resulting in faster downloads. It also en‐
courages a more expressive programming style, because it eliminates the download
cost of clean, literate self-documentation. It's recommended you use JSLint before
go beyond regular compression and also add advanced on-the-fly decompression
press the given source code in a manner that can be decompressed by regular web
browsers, as well as shrink variable names that are typically 5 to 10 characters to
single letters, which reduces the file size of the script and, therefore, makes it down‐
The YUI Compressor is a newer compressor written by Julien Lecomte that aims
to combine the safety of JSMin with the higher compression levels achieved by Dojo
ShrinkSafe. Like Dojo ShrinkSafe, it is written in Java and based on the Rhino library.