Diff for "JavaScriptBuildSystem"

Not logged in - Log In / Register

Differences between revisions 5 and 6
Revision 5 as of 2009-03-12 15:13:20
Size: 1531
Editor: mars
Comment:
Revision 6 as of 2009-03-20 10:25:04
Size: 1488
Comment:
Deletions are marked like this. Additions are marked like this.
Line 20: Line 20:
  <script type='text/javascript' tal:content="string:var icingroot='${icingroot}';" />   <script type='text/javascript' tal:content="string:var yui_base='${yui}';" />
Line 22: Line 22:
YUI({base: '/+icing/' + icingroot + '/yui/current/build/'}).use( ... YUI({base: yui_base + '/'}).use(

The Launchpad JavaScript Build System

Most of the Launchpad JavaScript is bundled, minified, and distributed in one large stand-alone file: launchpad.js.

Adding new YUI3 JavaScript modules

A special script, utilities/yui_deps.py, looks in the main site template for <script> lines that point to YUI3. The corresponding minified script files are extracted from the current YUI3 build and added to launchpad.js.

To add a new YUI3 dependency, just add a new <script> line to the main site template.

Dynamic import of YUI CSS

Sometimes when you import new YUI3 modules as above, you may still continue to see the security warning because YUI is dynamically loading the CSS required for the new modules from it's own servers. To avoid this you can tell YUI the base directory for it's imports like this:

  <script type='text/javascript' tal:content="string:var yui_base='${yui}';" />
  <js tal:replace="structure string:<script type='text/javascript'>
YUI({base: yui_base + '/'}).use(

Or if this is part of a general CSS component, it's better to add that CSS to the main template.

That depends if the YUI Loader can tell that it's required CSS files are already present on the page. Unlike JS files, when you read a CSS file, there is nothing to indicate that it fulfills a YUI Loader requirement. -- mars 2009-03-12 15:13:20


CategoryJavaScript

JavaScriptBuildSystem (last edited 2020-10-27 10:23:00 by twom)