Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Closure Library and Closure Templates do not depend on one another, so you can certainly use Closure Templates with jQuery without pulling in the Closure Library or the Closure Compiler. To use Templates with jQuery, you translate your Closure Template files (aka "Soy" files) using <code>SoyToJsSrcCompiler.jar</code> <a href="http://code.google.com/closure/templates/docs/javascript_usage.html">as described in the documentation</a>. Then you will have one JavaScript file for each Soy file where each JavaScript file contains one function per template defined in the corresponding Soy file.</p> <p>To use the generated JavaScript functions, you must also include <a href="http://code.google.com/p/closure-templates/source/browse/trunk/javascript/soyutils.js">soyutils.js</a>, which is a set of utilities required by the generated functions. Therefore, your production system should include the following JavaScript files concatenated/minified in this order:</p> <ul> <li><code>soyutils.js</code></li> <li>JavaScript generated from Soy</li> <li>jQuery library</li> <li>Your application code, which presumably depends on both jQuery and your template functions.</li> </ul> <p>Getting up to speed on Closure Templates is considerably easier than learning the Library or the Compiler, so I'm sure that your dev team can pick it up quickly. I believe the <a href="http://code.google.com/closure/templates/docs/overview.html">online documentation</a> is thorough without being overwhelming, so the syntax and usage should not take long to learn.</p> <p>Note that if you decide to use the Closure Library instead of jQuery at some point, you should include <a href="http://code.google.com/p/closure-templates/source/browse/trunk/javascript/soyutils_usegoog.js">soyutils_usegoog.js</a> instead of <a href="http://code.google.com/p/closure-templates/source/browse/trunk/javascript/soyutils.js">soyutils.js</a>. Though if you decide to rewrite your application logic to depend on Closure Library instead of jQuery after you have a substantial amount of code, this small change will likely be the least of your concerns! That is, I'm sure you could ultimately write your entire application using Google Closure, but migrating from one JavaScript library to another for a large application will likely require so many code changes that you may be too intimidated to take on the migration.</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