Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Requiring a closure-stylesheet css renaming map from a soy template
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matt Powell  
View profile  
 More options Apr 10 2012, 2:55 am
From: Matt Powell <mttp...@gmail.com>
Date: Mon, 9 Apr 2012 23:55:47 -0700 (PDT)
Local: Tues, Apr 10 2012 2:55 am
Subject: Requiring a closure-stylesheet css renaming map from a soy template

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kyaw  
View profile  
 More options May 28 2012, 11:06 pm
From: Kyaw <kyawt...@gmail.com>
Date: Mon, 28 May 2012 20:06:11 -0700 (PDT)
Local: Mon, May 28 2012 11:06 pm
Subject: Re: Requiring a closure-stylesheet css renaming map from a soy template
you shouldn't need cssNameMapping in template.soy.

On Apr 10, 2:55 pm, Matt Powell <mttp...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Bolin  
View profile   Translate to Translated (View Original)
 More options May 30 2012, 5:21 pm
From: Michael Bolin <bolinf...@gmail.com>
Date: Wed, 30 May 2012 14:21:05 -0700
Local: Wed, May 30 2012 5:21 pm
Subject: Re: Requiring a closure-stylesheet css renaming map from a soy template

Use {css long-name} in Soy, but you also need to pass
--cssHandlingScheme=goog when generating the JS from the Soy.
Unfortunately, I don't see that flag listed on
https://developers.google.com/closure/templates/docs/javascript_usage, but
you can find it in the source code:
http://code.google.com/p/closure-templates/source/browse/trunk/java/s...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »