Is there a way to force classes to be *included* in the renaming map?
Effectively, I'm looking for the opposite of the
--excluded_classes_from_renaming option :-)
I'm using the full Closure suite (compiler, templates, library,
linter, stylesheets) and I use goog.dom.getElementByClass to my
elements, for example:
var dialogDiv = /** @type {Element} */
soy.renderAsFragment(myapp.templates.dialog);
var okDiv = goog.dom.getElementByClass(goog.getCssName('ok_button'),
dialogDiv);
The soy template, of course, uses {css ok_button} to ensure that
renames are handled.
The problem is that if a class's style turns out to be empty then
Closure Stylesheets does not include it in the generated CSS (which is
logical), or in the renaming map. The code still works, but class
names are which have empty styles end up not being renamed, and the
generated JavaScript ends up being larger than necessary.
Is there a way to force either all classes, or certain classes that I
specify, to be included in the renaming map? Or maybe I'm using the
wrong approach here...
Many thanks,
Tom
.foo {}
The first one. The renaming map doesn't contain entries for .foo {}.
I believe it is correct that .foo should not appear in the CSS.
Cheers,
Tom
That's code for "send me a patch" right? :-)
My Java skills are pretty rusty, but I'll have a play.
Regards,
Tom
I've split it into two:
The first adds the infrastructure for the command line argument and an
appropriate member variable to JobDescription. This is (I hope)
relatively uncontroversial.
The second patches in the implementation. As the actual renaming map
is a private member variable of the CssClassRenaming class, and is
therefore not visible outside the class, this is done by adding the
requested classes to the renaming map at the end of
CssClassRenaming.runPass(). This might reasonably considered to be a
hack. But it works :-)
Regards,
Tom
No functional change, but it has been bugging me all day :-)
Regards,
Tom