0
votes

I'm developing an extjs application which boots in two steps. At the start it pops up a login& password window, loading only the necessary js resources. If login successfully then it starts the viewport by loading all the remaing js files.

at the login time it loads ext-all.js and couple of app js file. after the login, it loads the controllers that load the required js files.

the problem is that I want to minify and compress the js files, but when using the sencha cmd tool


        >sencha create jsb -a index.html -p app.jsb3
        >sencha build -p app.jsb3 -d .
        >java -jar ycompressor.jar --type js -o app-all-compressed.js app-all.js

the resulting app-all.js and app-all-compressed.js contain only the resources needed at the login phase only.

Then I tried to build manually a jsb3 file that generates a minified and compressed post-all.js including by hands the required js by the viewport (second phase boot), then loaded this file after successfully passed login this way:


        onLoginSuccess(){

        Ext.Loader.loadScript({
        url: 'post-all.js',
        scope: me,
        onLoad: function() {
            //controllers loading
             ...

problem was that even if post-all.js is loaded, the resuorce are still loaded unminified. Resources are minified and compressed correctly in post-all.js but it seems that requires[" ..."] loads the unminified copy of the resources, so I have each reasource loaded 2 times

Any idea?

thanks

1

1 Answers

0
votes

It is a lot easier to load everything at once. There is no reason to load in two times.

  • Visual : Even if you load all javascript, you show only the login dialog. All the rest, you show only after successful login.
  • Security : If you secure the access to all server resource with the session, a malicious user might be able to display some parts of the user interface, but he could never get to view any data nor do anything else.
  • Loading time : Considering the size of the ExtJs library, the gain in loading time will be minimal.

Like this you've worked around your problem, and you can enjoy the simplicity of the regular ExtJs deployment with Sencha cmd.