how to use CssResource.obfuscationPrefix to have semi-obfuscated css class name

268 views
Skip to first unread message

emerix

unread,
Jan 6, 2010, 10:07:24 AM1/6/10
to Google Web Toolkit
Hi,
I found on this page
http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideClientBundle.html#Selector_obfuscation
that you can use the property CssResource.obfuscationPrefix to choose
how to obfuscate your css selectors.
However I don't know if it is possible to use it to have a custom
obfuscation.
During the development phase, I'm using firebug to adjust padding,
margin... of my widgets and it became quite difficult with the
obsucated css class names...

What I would like is a way to have .G1qdtwdtK-MyWidgetName instead
of .G1qdtwdtK for a css class named .MyWidgetName

Is that feasible ?

thanks !

fvisticot

unread,
Jan 6, 2010, 5:47:29 PM1/6/10
to Google Web Toolkit
Hello,
Did you try this (in your app module):

<set-configuration-property name="CssResource.style" value="pretty" />

On 6 jan, 16:07, emerix <rafa...@gmail.com> wrote:
> Hi,

> I found on this pagehttp://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideClien...

Brendan Kenny

unread,
Jan 7, 2010, 12:42:39 AM1/7/10
to Google Web Toolkit
Yeah, I ran into the same problem. If the issue is just exposing the
style names during development (and you're not looking for this
particular solution for an additional reason), I would do as fvisticot
suggests and then just remove that line from your module's xml file
when you're ready for production mode. It's been a while since I
looked at this, but I believe I also just used

@external styleName;

in the ui:style section to prevent particular style names from being
obfuscated. I found the example here a little confusing, but the
concept is simple enough:
http://code.google.com/p/google-web-toolkit/wiki/CssResource#External_and_legacy_scopes

On Jan 6, 9:07 am, emerix <rafa...@gmail.com> wrote:
> Hi,

> I found on this pagehttp://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideClien...

emerix

unread,
Jan 8, 2010, 8:26:35 AM1/8/10
to Google Web Toolkit
thanks a lot for your replies !! that's exactly what I needed :)

On Jan 7, 6:42 am, Brendan Kenny <bcke...@gmail.com> wrote:
> Yeah, I ran into the same problem. If the issue is just exposing the
> style names during development (and you're not looking for this
> particular solution for an additional reason), I would do as fvisticot
> suggests and then just remove that line from your module's xml file
> when you're ready for production mode. It's been a while since I
> looked at this, but I believe I also just used
>
> @external styleName;
>
> in the ui:style section to prevent particular style names from being
> obfuscated. I found the example here a little confusing, but the

> concept is simple enough:http://code.google.com/p/google-web-toolkit/wiki/CssResource#External...

PKolenic

unread,
Jan 12, 2010, 4:26:10 PM1/12/10
to Google Web Toolkit
I found that it is useful to have two .gwt.xml files
1) application.gwt.xml
2) applicationDebug.gwt.xml

Then in the ant file I have a gwtc_debug target
so that:

<target name="gwtc" depends="javac" description="GWT compile to
JavaScript">
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a
StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG
-->
<arg value="path.Application"/>
</java>
</target>

<target name="gwtc_debug" depends="javac" description="GWT compile
to JavaScript">
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a
StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG
-->
<arg value="path.ApplicationDebug"/>
<arg value="-style"/>
<arg value="PRETTY"/>
</java>
</target>

This saves some time when switch between development and deployment.

Reply all
Reply to author
Forward
0 new messages