Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I do not know what Magento e-commerce uses, but I know what JavaScript Compilers are.</p> <p>Pre-Compiled JavaScript is not practical as the various JavaScript interpreters will have their own method of compiling. Therefore, when most people talk about Compiling JavaScript, they are usually referring Minified JavaScript.</p> <p>However, the latest minifiers go way beyond. A good example is <a href="http://code.google.com/closure/compiler/" rel="nofollow">Google Closure Compiler</a> <a href="http://code.google.com/closure/compiler/docs/api-tutorial3.html" rel="nofollow">Advanced Mode</a>. It is related to <a href="http://code.google.com/closure/" rel="nofollow">Google Closure Library and Tools</a>, but is well designed even when used by itself.</p> <p>There is an <a href="http://closure-compiler.appspot.com" rel="nofollow">Online Demo of Closure Compiler</a>.</p> <p>It is called a Compiler because it is more than a minifier and the name JavaScript Compiler is not used for anything else. For example: This code</p> <pre><code>function hello(name) { alert('Hello, ' + name); } hello('New user'); </code></pre> <p>compiles to <code>alert("Hello, New user");</code> in advanced mode. Single-use functions are removed, variable names are shortened, and even re-used.</p> <p>It is very thorough. Simple mode assumes that there might be other JavaScript involved. in which case it would preserve the <code>hello</code> function. Advanced mode assumes that there is only a single JavaScript file, or that it is properly exported.</p> <p>The one thing that keeps this from really being compiled is that it is not bytecode like compiled C or Java would be. It still has to be compiled at run-time like Perl.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload