On 12 mar, 01:51, Allahbaksh Asadullah <[email protected]> wrote: > Hi, > In most of cases we face situation where there are existing JavaScript > library available to do specific job (Example Online Diff). We don't want to > write it again but number of HTTP request to get those JavaScript files are > some times huge. > Can we bundle javascript or load it as Text Resources and do something with > it? Is something of that sort could save lot of HTTPRequest? > > Can some one let me know whether the idea of doing this is good or it will > not workout properly.
Two solutions come to mind: a) use a GWT Linker [1,2] to prepend scripts dependencies (<script/> in your modules' gwt.xml) to the selection script; the problem is that the selection script isn't (shouldn't be) cached, so it should remain as small as possible. b) use YUI Builder [3] to concatenate (and minify) all your scripts into a single file; it should be done up-front as it impacts your <script> tags (in your page and/or your modules) c) combine both: use a linker to combine the scripts into a single file. (yes, that makes three solutions...) For options b and c, I'd recommend using a <strong name>.cache.js file name; and you can of course process stylesheets too. [1] http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&t=ReleaseNotes_1_5_Compiler [2] http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/core/ext/Linker.html [3]http://yuilibrary.com/projects/builder --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
