Use ClientBundle in a large Enterprise Application?

巧了我就是萌 提交于 2019-12-30 08:33:23

问题


We're building a large enterprise application (dozens of modules) with GWT and need to decide whether to use ClientBundle or not. I was curious what pros/cons the StackOverflow GWT community view as deal makers and deal breakers for such a use case.

As far as we see it currently:

Pros

  • All images/css files that take up server resources to download are eliminated
  • Client loads faster because of the above (i.e. inlined image urls)
  • CSS names are obfuscated, so namespace collisions are eliminated
  • CSS is automatically optimized / verified
  • Unused CSS classes are eliminated (above)
  • Java reference to class names are replaced with refactorable css interfaces
  • UiBinder reference to class names are replaced with refactorable css interfaces
  • No more big "main.css" fails as resources are module bundle specific

Cons

  • For maintenance CSS becomes either unreadable in obfuscated mode, or extremely verbose in debug mode
  • More steps needed for basic CSS work (like adding class)
  • All devs must know Java,CSS,HTML nuances
  • CSS3 and other at-rules (i.e. @font-face) are not supported by GWT natively
  • Increased compilation times

Thanks!


回答1:


I have been using client bundle heavily in m-gwt.

One thing that was bothering me was styling for devices that did not have dev mode. So styling could mean recompiling the complete app.

Mostly all CSS3 Rules can be used in ClientBundle by using the literal function, so that should be okay. It gets a little tricker with @media queries. You can inject the css as a simple textresource as a workaround, but its kind of ugly.

When you are talking about several gwt modules, consider using multiple clientbundles so you can still use split points to keep the download file size under control (Depending on how big your .js files get)

I have used clientbundles in several big gwt apps and for me compile time checking and refactoring support beats the little quirks that are still in client bundles.




回答2:


Just two additional notes:

  • There is a utility available in GWT which allows to automatically create the interfaces for your CSSResources
  • It's true that debugging styles can be a little bit cumbersome because of the obfuscated names. I had good success by using Firebug to change styles in dev-mode directly in the browser and when I am satisfied I change them in my GWT app.


来源:https://stackoverflow.com/questions/8042977/use-clientbundle-in-a-large-enterprise-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!