Merge GWT generated files

北城以北 提交于 2019-12-11 07:43:17

问题


I'm trying to create a JavaScript library from GWT. The big deal: I want to merge the JavaScript files into one.

Basicly GWT generate two files:
[Your_Project].nocache.js => The bootstrap
[MD5].cache.html => The proper(?) JavaScript API.

index.html---load--->[Your_Project].nocache.js ----load---->[MD5].cache.html

I'm trying to change that by:
index.html ---load--->everything.js


But how to merge [Your_Project].nocache.js and [MD5].cache.html into one JavaScript file...?

I'm not sure it gonna be an easy task.

Martin Magakian


回答1:


It's possible but only for one single distinct compilation. For example, the following compiles one single file for Firefox:

<set-property name="user.agent" value="gecko"/> 
<add-linker name="sso"/>

Because GWT generates browser specific versions, this means only one browser is supported in the compiled file. If you need other browsers change the user.agent and compile again. Note if you do want to support multiple browsers, you need to serve the correct version to the user, something GWT does for you if you use the normal compilation process. So I'm not sure if this is what you really want.




回答2:


Use

<collapse-all-properties />
<add-linker name="sso" />

in your ProjectName.gwt.xml file. This way all permutations are joined in a single JavaScript file.



来源:https://stackoverflow.com/questions/4453302/merge-gwt-generated-files

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