PDA

View Full Version : Application compression



Phally
20 Sep 2011, 5:22 AM
I have a build script that concatenates the contents of the js files, minifies the script and then puts it into a single file. However, the Ext.Loader keeps loading the files using AJAX and when I disable Ext.Loader it stops loading the files, but also stops the application from working.

So, my question: How can I disable loading files (so that it uses the classes that are already loaded in that single file) without breaking the application.

Thanks in advance.

lucasguaru
21 Sep 2011, 5:45 AM
Make sure you added the script to you main html file.
When the class is loaded, the Loader doens't need to get it again.

Phally
21 Sep 2011, 8:37 AM
I agree with that. It doesn't need to get them, yet it does. Hence I asked the question. ;)

mberrie
21 Sep 2011, 8:04 PM
The intended behavior actually worked for me in the past.

Ext.Loader will only request files for classes that have not been loaded yet. If you include a javascript file with the class definition statically before any other class that references this class, Ext.Loader will be happy with it and not try to load the corresponding JS file.

I can just guess that maybe your concatenated file does not include your classes in the correct order. When your class definitions get processed (i.e. the Ext.define calls execute one by one), the class manager probably encounters a class that has a dependency on another class that has not been loaded yet (because it is defined later in the file.), hence Ext.Loader will try to load the corresponding JS file.