Minimize project size when using GWT-Ext

7 views
Skip to first unread message

Gabriel Gutierrez

unread,
Mar 31, 2009, 4:36:59 PM3/31/09
to GWT-Ext Developer Forum
Well this is just a tip not a question.

Today I was doing an application and i realice that when you use GWT-
Ext the .war sizes more than a megabit because of the ext-js files and
the libraries.

So the first and dummy thing, was to move all libraries to the common
server lib folder. (reduces a lot). If you do only this, the
application still will size more than a mega.

So if your production or wharever server is in another country and you
need to go under internet or a VPN you still need to pass more than a
mega, and without a good brandwith it could take some time, so this
can help a bit, not much but is something.

For the ext-js files i came with this:

1.- I build another web project that only have js-ext files inside the
webcontent folder, lets called it "resources"

resources.war
+ WEB-INF
+ web.xml
+ METAINF
+ js (this is the folder where all ext-js files are)

then create the war and uploaded into the web server, this war will
size about 600 Kb

Remove any welcome file, cuz this will be for .js, .css and images, so
there shouldn't be any .html or .jsp files here, if you dont do this
nothing will happen is just to reduce a bit the size of this file.

Then in the app project, locate the module.gwt.xml file and add the
full path of the ext-js resources, something like

<module>
<stylesheet src="http://IP.AD.DR.ESS<:PORT>/resources/js/ext/
resources/css/ext-all.css" />
<script src="http://IP.AD.DR.ESS<:PORT>/resources/js/ext/adapter/ext/
ext-base.js" />
<script src="http:/IP.AD.DR.ESS<:PORT>/resources/js/ext/ext-all.js" /
>
/* ... other stuff here .... */
</module>

And finally test your app,

Here are some good point that i see by doing this.

+ You don't need to add ext-js files in every application you do.
+ Application's size gets reduced in a significant way (4.7 megas from
gwt-servlet, gwt-user and gwt-ext libs, and about 600 Kb from ext-js
file)
+ If you want to change ext-js version, just replace the resources.war
project, there is no need to change/restart the rest of the
applications (imaging havin 5 o more applications to update)

Disadvantages so far...

+ An outside project can use your server as a resource server (but
this will happen too in the normal way).

If you have any comment ( and i know this is a bit dummy, but i wanted
to post it) or disagrees, please do it.

I tested in a local and remote servers and it worked so far.

Dariusz Borowski

unread,
Apr 2, 2009, 4:26:06 PM4/2/09
to gwt...@googlegroups.com
Hey, that's the point! The idea of putting the extjs sources in public folder is a little bit heavy and not very useful. 2 days ago, I posted a question exactly about the same subject.

Isn't it possible to have one directory in your webapp/application where you point your modules to it? I was thinking not to point to a different domain, rather than to directory inside your application.

D.

Gabriel Ernesto Gutierrez Añez

unread,
Apr 2, 2009, 4:44:13 PM4/2/09
to gwt...@googlegroups.com
Also, what it is in the public gets duplicated. it is added again in
the webcontent after compile. ( so there is a megabyte minimun )

maybe, it would be nice to have like an spetial tag for looking the
resource that could act as relative and abosolute as well. maybe a tag
like

<resource-folder path="">

and when you type <stylesheet src=""/> you will use relative path
begining from the resource folder path that eventually it will
translated to

<resource-folder-path><stylesheet-src>

But i think if you have it inside your app in a diferent directory as
you said, you'll have to upload it everytime it will be the same.

Regards,

On 4/2/09, Dariusz Borowski <dari...@gmail.com> wrote:
> Hey, that's the point! The idea of putting the extjs sources in public
> folder is a little bit heavy and not very useful. 2 days ago, I posted a
> question exactly about the same subject.
>
> Isn't it possible to have one directory in your webapp/application where you
> point your modules to it? I was thinking not to point to a different domain,
> rather than to directory inside your application.
>
> D.
>
>
>
> On Tue, Mar 31, 2009 at 10:36 PM, Gabriel Gutierrez
> <gutier...@gmail.com>wrote:
--
_____________________
Ing. Gabriel Gutiérrez
Celular: +52 1 81 1071 7213
Oficina: +52 81 8153 2415
Monterrey, México

Dariusz Borowski

unread,
Apr 3, 2009, 1:41:12 AM4/3/09
to gwt...@googlegroups.com
The idea what Gabriel is explaining would be awesome. I'm happy with everything so far what GWT-EXT came with, except this duplicate thing with extjs resources.

Maybe Sjivan feels like being merciful today and can think about it... ;-)

I would really appreciate if the design would change heading towards Gabriel's idea.

Thanks,
Dariusz





On Thu, Apr 2, 2009 at 10:44 PM, Gabriel Ernesto Gutierrez Añez <gutierrez.ge@gmail.com> wrote:

Also, what it is in the public gets duplicated. it is added again in
the webcontent after compile. ( so there is a megabyte minimun )

maybe, it would be nice to have like an spetial tag for looking the
resource that could act as relative and abosolute as well. maybe a tag
like

<resource-folder path="">

and when you type <stylesheet src=""/> you will use relative path
begining from the resource folder path that eventually it will
translated to

<resource-folder-path><stylesheet-src>

But i think if you have it inside your app in a diferent directory as
you said, you'll have to upload it everytime it will be the same.

Regards,

On 4/2/09, Dariusz Borowski <dari...@gmail.com> wrote:
> Hey, that's the point! The idea of putting the extjs sources in public
> folder is a little bit heavy and not very useful. 2 days ago, I posted a
> question exactly about the same subject.
>
> Isn't it possible to have one directory in your webapp/application where you
> point your modules to it? I was thinking not to point to a different domain,
> rather than to directory inside your application.
>
> D.
>
>
>
> On Tue, Mar 31, 2009 at 10:36 PM, Gabriel Gutierrez
Reply all
Reply to author
Forward
0 new messages