Low-level API to build urls for js and css yui modules
In some cases, you want to produce urls to preload yui modules or yui css modules. Since all those modules are part of the meta generated by app.yui.plugin() thru Locator, and we also have access to each group and the configuration of those groups from app.js, we can generate those urls easily.
To build a list of urls to load a list of yui modules:
var scripts = app.yui.buildJSUrls('node', 'photos@hermes');
As a result, scripts will be an array with one or more urls that you can use in your templates to insert script tags. Modules as photos@hermes denotate a module from a particular group,
as in <module-name>@<group-name>. Modules without the group denotation
will be assumed as core modules from yui.
To build a list of urls to load a list of yui css modules:
var links = app.yui.buildCSSUrls('cssbase', 'cssflickr@hermes');
As a result, links will be an array with the urls that you can use in your templates to provision styles.
Modules as cssflickr@hermes denotate a module from a particular group, as in <module-name>@<group-name>. Modules without the group denotation will be assumed as core modules from yui.
Other notes:
- dependencies computation is not part of the deal, you have to deal with that, both method are expecting the final list of modules to generate the urls.
- depending of the configuration in
app.jsthe urls returned by both methods will be combo urls or not. - the data under
window.YUI_config.seed, which is part of thestateobject, is now usingbuildJSUrlsunder the hood to produce the seed urls.