Can you make your scripts smaller?

Minifying your JavaScript is something most people are familiar with and have to do fairly regularly, whether is reducing your page load time on PC or keeping the files within the mobile cache limits.

Having recently seen UglifyJS and having used some of the more obvious tricks (!0 === true, !1 === false, etc) myself, I wondered if there was a way you could shrink down what’s transferred even more…

As a proof of concept I’ve knocked up a (hopefully fairly) simple perl script that will wrap your code in a closure and replace a lot of the internal indexes that are used with global symbols, which when compressed with YUI/Uglify should reduce filesize overall.
Continue reading “Can you make your scripts smaller?”