GWT CSSResrouces - which advantage or best way

Hey, I'm developing a GWT application and now look at the CSS part. I read a lot about this topic on the official website, but still have a few questions and hope someone can give me a hint.

  • When I use CSSResource, the css styles will be compiled into code - right? So this cannot be changed without recompiling the application. But I want the styles to be edited from the outside.
  • So, what is this CSSResource for, since you can't just change the color or image without compiling the application again?
  • What is the best way to use CSS, since there are several ways to do this (.css file, CSSResource, styles in ui.xml)?

My thoughts now are that I use only regular CSS file to process all my “volatile” things and add this file to my head, since I do not see the benefits of this CSSResource thing. Hope someone can help me. Thank.

+3
source share
1 answer

It all depends on how you work with CSSes - if you need to apply small changes, first check them out live in Firebug / a similar tool. At the design stage (when you still don't have a final idea of ​​how you want to style the application), you may want to work with regular CSS files, but as soon as the general style becomes clear, you should switch to ClientBundle / CssResource.

? , goals, CssResource:

  • Primary

    • CSS, GWT (, CSS)
      , ,
      . , CSS, - , - , ( )
    • - , . , (, ) CSS, .. - -, ( , ) - (Firebug). , ( , Google Eclipse).
    • Minification - -, selector property . . .
    • GWT - CSS ( GWT , ), . CSS, ? (. CSS)
    • CSS , - CSS JS-, () - IE- !
    • -
    • CSS-
      • API- API- - CssResources (, )
      • CSS , - , - () CSS , , UiBinder (, , CssResource ) , , CssResource . , CSS ( , ). , (, , ocde, ), .
    • BiDi ( Janus?) - , , :)
    • CSS- - sprites - ?;)
    • " CSS"
      • - CSS - , (, , ) - , , ( CSS - )
      • - , ,

StyleInjector . , CssResource ( , , ) . , CssResource, :

@eval userBackground com.module.UserPreferences.getUserBackground();
div {
  background: userBackground;
}

userBackground ( constants, ).

+7

Source: https://habr.com/ru/post/1768183/


All Articles