I'm using soy templates to render full html pages (the templates are compiled to js and executed w/ nodejs). I'm also using closure-stylesheets (gss) with --output-renaming-map-format set to CLOSURE_COMPILED. This generates a js file that calls goog.setCssNameMapping with a map of the shortened classnames. The part I'm stuck on is making the generated js file a dependency of the template that it needs to be used in. Ideally, I'd prepend the generated js file w/ a goog.provide call and I'd have a custom soy function that would set a flag to add a goog.require call referencing the generated js file from the compiled template. (btw, I'm compiling the templates w/ shouldProvideRequireSoyNamespaces and node is taking care of the goog.provide and goog.require calls).
Here's what it'd look like in actual code:
===map.js===
//generated from gss file
goog.provide('namespace.map');
goog.setCssNameMapping({'long-name':'a'});
========
===template.soy===
{template ...}
{cssNameMapping('namespace.map')/}
<span class="{css long-name}"></span>
{/template}
========
===template.soy.js===
//executed from within node
goog.require('soy');
goog.require('namespace.map');
namespace.template = function(){return '<span class="'+goog.getCssName('long-name')+'"></span>'}
========
cssNameMapping would be an implementation of SoyJsSrcFunction, but, would somehow tell the compiler to add a goog.require statement w/ the first passed in parameter ('namespace.map').
So, think some variation of this is possible? And if so, tips on where I should start looking?
Thanks,
Matt