1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    334
    Vote Rating
    15
    Answers
    4
    jweber will become famous soon enough

      0  

    Default Answered: Pre-loading all of Ext during development

    Answered: Pre-loading all of Ext during development


    During development, I normally include the sencha-touch-all.js file, so I don't have to wait for each individual class to load.

    But with the final release of ST2, it looks like the recommendation is to only include the "microloader/development.js" file, and no other JS/CSS files.

    My problem is that this file loads each class individually, with a _dc argument so they're not cached. This means that every time I reload the page, it loads every class, which takes a long time.

    Is there a way to tell the microloader to pre-load sencha-touch-all.js during development, but not when building?

  2. Changing "sencha-touch.js" inside "app.json" to "sencha-touch-all.js" is the right way to achieve what you want, however support for different json config files between development and production is not yet in place.

    Also try adding "?cache" query string at the end of your app's URL, which will turn off the cache buster, so there won't be any extra timestamp added to each file's URL when it's dynamically loaded.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,117
    Vote Rating
    453
    Answers
    3160
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You can use the build file with all the classes during development but you need to require the classes that your application files need. For instance, if you have a component you created that requires Ext.Anim, then you need to add it to it's requires array...

    Code:
    Ext.define('MyApp.view.AnimComp', {
        extend : 'Ext.Component',
    
        requires : [ 'Ext.Anim' ],
    
        ...
    });
    When you do the build, it will looks at the different properties that handle file dependancies to build it into one. This will then prevent any classes to be dynamically loaded as is wanted.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    334
    Vote Rating
    15
    Answers
    4
    jweber will become famous soon enough

      0  

    Default


    OK. I thought I might be able to get rid of my multiple index.html files, but I guess not.

    This brings me to another question. If I have an index.html and an index-production.html, how do I specify which one is used by the "sencha app build" command? I used to be able to use "sencha create jsb -a index-production.html", but I don't see a similar place in the app.json file to specify the index file.

  5. #4
    Sencha User
    Join Date
    Mar 2007
    Posts
    334
    Vote Rating
    15
    Answers
    4
    jweber will become famous soon enough

      0  

    Default


    Oh, I guess the microloader uses the app.json file, even during development. So I can use two different app.json files; one for development (with sencha-touch-all.js) and one for building (with sencha-touch.js).

    But it doesn't seem like there's a way to specify which app.json file to use when running "sencha app build".

  6. #5
    Sencha - Sencha Touch Dev Team Jacky Nguyen's Avatar
    Join Date
    Jul 2009
    Location
    Palo Alto, California
    Posts
    469
    Vote Rating
    9
    Answers
    24
    Jacky Nguyen will become famous soon enough Jacky Nguyen will become famous soon enough

      0  

    Default


    Changing "sencha-touch.js" inside "app.json" to "sencha-touch-all.js" is the right way to achieve what you want, however support for different json config files between development and production is not yet in place.

    Also try adding "?cache" query string at the end of your app's URL, which will turn off the cache buster, so there won't be any extra timestamp added to each file's URL when it's dynamically loaded.
    Sencha Touch Lead Architect

Tags for this Thread