Merge GWT generated files
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 try开发者_JAVA百科ing 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
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.
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.
精彩评论