Search code examples
gwtdeferred-loading

is it possible to dynamically include scripts via .gwt.xml?


how can i take advantage of GWT's deferred binding mechanism for script resources (e.g. CSS, JavaScript)?

the <define-property ... /> and <set-property ... /> ( when used in conjunction with <when-property-is ... /> ) does not provide this functionality since they're used for Java types binding.

thanks in advance!


Solution

  • Since the is used for Java types, you can use that paradigm and wrap your css and js in java/gwt classes. The js will use the native js interface to wrap up the methods and the css can be included in a CssResource/ClientBundle class. Then just use the gwt.xml file to use whichever one you need for the conditions you have.