In my GWT application there is a log of CssResource declarations I
created for custom widgets. All of them have to be injected manually
by using familiar StyleInjector helper class. I came up with the
following idiom for this:


final class AppPanelRes {
  public interface Resources extends ClientBundle {
    @Source("AppPanel.css")
    Style style();
  }

  public interface Style extends CssResource {
    String window();

    ... more methods ...
  }

  static final Resources res = GWT.create(Resources.class);

  // here is the magic piece of code to inject styles automatically
  static {
    StyleInjector.inject(res.style().getText());
  }
}


Note that static class initializer injects css styles for me
automatically when that class is being referenced for the very first
time.

However, in the latest GWT2.0 builds that I make from the repository
trunk this code stopped to work correctly for some reason. It still
works in hosted mode, but when I compile and deploy to the production
environment, I don't see any styles.

I think there may be a better alternative to this idiom with static
class initializer injecting styles. Can GWT compiler automatically
create superbundle from all css resources and automatically inject it
when the application starts?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to