Categories
josephscott

Minification vs. Obfuscation

Douglas Crockford has post on the Yahoo! User Interface Blog discussing ways to reduce the size of your Javascript code, Minification v Obfuscation.

There are a couple of things that I wanted to highlight out of this discussion. One, obfuscators won’t prevent someone from figuring out your Javascript secrets. It might slow them down, but that is about it. So if you’ve been entertaining the idea that you can effectively “hide” your Javascript from users, don’t bother. Two, gzip can be your friend. As Douglas’s little table of code size shows, just using gzip can make a huge difference in the size of the file that your users have download. This of course only works for users of web browsers that support gzip encoding, but that is becoming less and less of an issue as time goes on.

Go read through some of their comments, especially Dustin Diaz‘s example on using PHPs ob_start (“ob_gzhandler”); to make compressing easy.

Leave a Reply

Your email address will not be published. Required fields are marked *