PDA

View Full Version : Ext.Loader requires over 200 files for Ext.Component?



el.weilando
17 Oct 2012, 9:30 PM
hi!

I need to minimize an ExtJs application by building an production-file with only the needed ExtJs classes.
If I use ext-core and Ext.Loader, ExtJs loads for this


Ext.create('Ext.Component',{
html:'test',
renderTo: Ext.getBody()
});

over 200 files.

When this is compressed and obfuscated, the final app-all.js has 660 KB. With the ext-core.js the complete app has, only for displaying an div with "test", 860 KB.

Is there an option to select only the files with Ext.Loader which I really need?

ExtJs is a very nice framework for big applications. But if want to use only some elements in a website, it generates, compared with other frameworks, a huge traffic.

a.premkumar
18 Oct 2012, 9:30 PM
Is there an option to select only the files with Ext.Loader which I really need?


Try using ext-all.js in you html file. this might help.

Regards,
Premkumar.

el.weilando
18 Oct 2012, 9:44 PM
Try using ext-all.js in you html file. this might help.

Regards,
Premkumar.
Then I have a file with 1.2 MB. 340 kb more.
The reason why i try to include only the classes which I need is, to minimize the framework.

scottmartin
19 Oct 2012, 7:10 AM
You can use the SDK/Sench Cmd to compile only the required files. In the SDK for example, it will create a JSB3 file.

Scott.

mberrie
19 Oct 2012, 9:31 AM
Just checked with Sencha Cmd and the resulting file is 699kB (includes core as well). If you use a GZIP filter on your web server, it will be maybe 210kB.

If you want to stay small then forget about ExtJs components and simply use Ext core to manipulate the DOM. ext.js is a little over 200kB minified and maybe 70kB gzipped.

Another strategy is to forget about custom builds and pull files from the CDN and hope that the client has the files in the cache. Personally, I think the chances of a cache hit are not very high though.

This is the Sencha Cmd script I used



compile
-cl=extjs-4.1.1a/src
union
-r
-c
Ext.Component
and
-debug=false
concat
-strip
-compress
test.min.js
and
metadata
-f
-o
test-dependencies.txt