Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 838
Jader Dias Avatar asked Jan 28 '09 23:01

Jader Dias


People also ask

What is the best JavaScript Minifier?

UglifyJS is one of the most popular JavaScript minification tools. It can parse, minify and compress JavaScript code. Besides, the tool generates a source map file while compressing to track back to your original code.

What is a Minifier tool?

JavaScript minification tools will reduce file sizes, thus improving web page performance as well as enhancing the code's presentation.

How does minify JavaScript work?

How Minification Works. Minification works by analyzing and rewriting the text-based parts of a website to reduce its overall file size. Minification extends to scripts, style sheets, and other components that the web browser uses to render the site. Minification is performed on the web server before a response is sent ...

What is Minified version of JavaScript file?

Minification refers to the process of removing unnecessary or redundant data without affecting how the resource is processed by the browser - e.g. code comments and formatting, removing unused code, using shorter variable and function names, and so on. See preprocessing & context-specific optimizations to learn more.


1 Answers

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.

like image 184
Aaron Wagner Avatar answered Sep 24 '22 05:09

Aaron Wagner