Note that there are some explanatory texts on larger screens.

plurals
  1. POClosure compiler app using jquery
    primarykey
    data
    text
    <p>I have manage to create a small size js application that uses jQuery and jQuery UI using google's closure compiler with advanced optimizations. Just for clarity: I have not compiled jQuery itself, just my app that uses jquery. I would like to know if somebody can confirm that this idea also works for bigger and more complex apps.</p> <p>The procedure is as follows:</p> <p>0.- You have an html file that calls jquery-1.4.3.min.js, test1.js, and test2.js</p> <p>1.- compile your app and export a property map file</p> <pre><code>java -jar closure-compiler.jar \ --compilation_level ADVANCED_OPTIMIZATIONS \ --js test1.js --js test2.js \ --property_map_output_file prop.out &gt; min.js </code></pre> <p>The property map is a key/value file that contains the name of the property before and after compilation:</p> <pre><code>aprop:a html:b each:c </code></pre> <p>2.- Copy prop.out to prop.in and edit it so that jQuery properties (functions) are replaced by the same name (this could be easily automated with a list jquery's function):</p> <pre><code>aprop:a html:html each:each </code></pre> <p>3.- Recompile using prop in as property map input</p> <pre><code>java -jar closure-compiler.jar \ --compilation_level ADVANCED_OPTIMIZATIONS \ --js test1.js --js test2.js \ --property_map_input_file prop.in &gt; min.js </code></pre> <p>4.- Now in your html, include min.js and jquery-1.4.3.min.js. The application should be functional but your code should be faster and smaller.</p> <p>This will minify your code, not jquery's.</p> <p>As I said, I have tested this in a small app. If somebody has a bigger and complex app, it would be nice to know that this works. </p> <p>Thanks,</p> <p>heg</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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