Documentation is really bad for CSS resource - don't think there is even 
any CSS code in the documentation itself...

Css file my.css would be placed in the same folder as 'MyResources.java' 
file

If my.css looks like the following:

.className {
 width:100px;
}

.something {
 width: 200px;
}

then MyCss interface must look like this:

interface MyCss extends CssResource {
  String className();
  String something();
}

Now in your actual code, where you have addStyleName("something") before, 
it must now be addStyleName(resources.css().something())

GWT will now create the minimum css for that style and inject it in.

On Monday, December 24, 2012 8:50:08 AM UTC+2, tong123123 wrote:
>
> For more information, we found if using jetty server and development, 
> changing css will reflect in browser in development mode, if using 
> externaml sever, then even using development, changing css will not cause 
> browse UI change.
>
> I have a look about cssResources at 
>
> https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle#CssResourceCookbook
> but feel very complicated, any simpler tutorial to teach about using it?
>
> in its documentation, 
>
>> Obfuscated CSS class names
>>
>> CssResource will use method names as CSS class names to obfuscate at 
>> runtime. 
>>
>> interface MyCss extends CssResource {
>>   String className();
>> }
>>
>> interface MyResources extends ClientBundle {
>>   @Source("my.css")
>>   MyCss css();
>> }
>>
>> All instances of a selector with .className will be replaced with an 
>> obfuscated symbol when the CSS is compiled. To use the obfuscated name: 
>>
> MyResources resources = GWT.create(MyResources.class);
> Label l = new Label("Some text");
> l.addStyleName(resources.css().className());
>
> in a normal css file, there should be many class name, so how to insert the 
> classname in addStyleName()?
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/bcJoCcA6GE4J.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to