JavaScript Upgrade Strategy #14: Minification

Minification is the process of reducing the amount of space a JavaScript file occupies by removing things like formatting and comments and overall rewriting the code to take up less space.

This generally gives you a slight gain in performance because smaller files are faster to download from the web site.  The biggest issue you face is debugging is very difficult because the JavaScript is no longer in what could be a human-readable form.  It is still JavaScript but very hard to follow.

Some organizations consider this as an option if they have an extremely large code-base and want to keep performance as high as possible.

While this is an option in certain cases, remember that almost all browsers support caching of website elements, like images and JavaScript libraries and they are only downloaded when necessary.  In general, I think this gives you a better performance gain than producing minified code, but your mileage may vary, depending on the situation.

Leave a Reply