Which Javascript minifier (cruncher) does the same things that the one Google uses for its JS APIs?

Jader Dias picture Jader Dias · Jan 29, 2009 · Viewed 26.1k times · Source

I am a Google Maps API (javascript) developer. I have noticed that Google uses a Javascript minifier that has the following features:

  1. Shortens variables, properties, arguments, classes, function and method names, obfuscating the code. (eg. function1 -> a, function2 -> b, function3 -> c)
  2. Some variables, classes, properties and methods can be marked to not be crunched, so its name remains the same as documented in the API manual.
  3. It is rerun in each subversion of the API, like a build task, I noticed that because of the crunched names changes from one version to another.

I have not found in the whole internet a Javascript minifier with those features. Anyone knows one?

Answer

Aaron Wagner picture Aaron Wagner · Nov 24, 2009

Google has now opened up the minifier they use along with some other internal javascript goodies.

It's all under the name "Closure Tools" and was announced earlier this month.