views:

111

answers:

5

I've inherited a high-traffic site that loads some Ext javascript files and I'm trying to trim some bandwidth usage.

Are Ext libraries necessary for development only or are they required for the finished site? I've never used Ext.: Ext JS - Client-side JavaScript Framework

The site loads ext-base.js (35K), ext-all-debug.js (950K), expander.js, exteditor.js. It appears that expander.js and exteditor.js have some site specific code, so they should stay?

But what about ext-base.js and ext-all-debug.js? Am I reading this correctly - are base and debugging libraries necessary for a live site?

A: 

I don't know much about Ext, but I think it's to assume that expander.js and exteditor.js depend on ext-base.js and ext-all-debug.js. As such, removing the latter two will break the site functionality.

The only thing I'd change would to switch from the debug version of ext-all to the production (which is most probably called ext-all.js and you should be able to load it from the same place the debug is located or from the Ext site).

Franci Penov
+3  A: 

Simply consult the documentation the previous developers have written for you. :P

To actually answer your question: You will more than likely want to keep all of the files available. You might however want to change ext-all-debug.js to ext-all.js since the debug file contains non-minimized Javascript.

Ben S
+1 Using ext-all.js instead of ext-all-debug.js will use less bandwidth. You could also minimize the other JS files to save some more.
wimvds
It might also be worthwhile merging all the javascript files into one to avoid needing multiple TCP connections.
Ben S
Yup, no documentation. But I will change to ext-all.js and also use a CDN, which I knew was possible with jQuery but not for Ext libraries. You were also the fastest answer.... Thanks.
songdogtech
A: 

One option would be to condense all of those files into one file (it would be larger, but it would reduce the overhead of multiple HTTP requests). Also verify that the server is sending the ETag and Expires headers, so that the browser can cache as much of it as possible...

ircmaxell
+1  A: 

ExtJS files are available to be hosted on the Cachefly CDN: Ext CDN – Custom Builds, Compression, and Fast Performance.

Hosting the files remotely should remove the load for at least those files.

As to which you can safely remove, you need a JavaScript developer to work on documenting what's truly necessary to your application.

As to what ExtJS is, it's a JavaScript library and framework - a la jQuery, YUI, MooTools, PrototypeJS, etc. So indeed, it can be critical to your site if your site relies on JavaScript to work.

artlung
Didn't know a CDN was available for Ext... Thanks.
songdogtech
Ext Core (at least) is available on the Google CDN as well: http://code.google.com/apis/ajaxlibs/documentation/#ext-core
artlung
+2  A: 

The previous posters are correct that if the site is actually using ExtJS, then you will need to keep the references to ExtJS. Assuming that you actually need to keep the references, replacing ext-all-debug.js with ext-all.js will save some bandwidth. Additionally, consider using one of the CDNs available now. For instance, using Google's CDN, you will save not only your own bandwidth, but bandwidth for your client and decrease page load times.

cleek
I change to ext-all.js and will go to a CDN, which I knew was possible with jQuery but not for Ext libraries. Thanks.
songdogtech