PDA

View Full Version : Shrinking the footprint of app-all.js



joelphilipgarcia
5 Sep 2011, 7:56 AM
Hello,

I'm trying to use Sencha 4.0.2a for a number of different applications. I'd prefer to use one JavaScript library for these applications, but I'm having some issues with the footprint of app-all.js for some of the simpler applications. The main issue is the footprint is too big.

One of the applications is a dynamically driven Form with an absolute layout. You can see the form by clicking here http://www.facebook.com/apps/application.php?id=132252616851904 and then clicking on HelpDesk or Support.

Today, after running "sencha create jsb", my jsb file still contains references to entities like the following:

{
"path": "../ext-4.0.2a/src/dd/",
"name": "DragSource.js"
},
{
"path": "../ext-4.0.2a/src/fx/",
"name": "Animator.js"
},
{
"path": "../ext-4.0.2a/src/chart/",
"name": "Chart.js"
},

I don't need drag and drop, animation, or charting for this particular app. I need a dynamically driven form with an absolute layout that's footprint is reasonable. The footprint today is 750 kb for a form.

I just got done walking the dependency hierarchy for some of my entities. It turns out the 'Ext.layout.container.Absolute' is what's sucking in the chart and some of the animation via requires: ['Ext.chart.axis.Axis', 'Ext.fx.Anim']. When I read the code for Absolute.js there is no reference to Axis and Anim so I commented the requires line out of ext-all-debug.js and Ext.layout.container.Absolute.js. I tested in dev and production mode, and the form application runs fine. I've just saved myself 25kb minified.

Is this a bug? I'm tempted to continue down the path of extracting only those entities that I need and keeping a separate copy of ext4.0.2a for only my form applications. Is this advisable? I know it will create headaches when I upgrade to a new version, but, otherwise, I don't see any other option...

Thoughts?

Thanks,
Joel

mitchellsimoens
6 Sep 2011, 5:53 AM
You can edit the JSB if you would like.

So what the build tools are doing is going through each of the requires and uses configs to build that JSB so all those classes are being required somewhere.

joelphilipgarcia
7 Sep 2011, 2:24 PM
Mitchell,

Thanks for the response .

I've been playing around with the jsb files that come with 4.0.2a. For some reason, they seem a little quirky as well. They make reference to jsb files that don't exist, e.g. ext-all.jsb3.

I just haven't had an opportunity to explore these issues yet.

Hopefully soon,
Joel