-
8 Mar 2012 11:03 AM #1
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?
-
Best Answer Posted by Jacky Nguyen
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.
-
8 Mar 2012 11:43 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,117
- Vote Rating
- 453
- Answers
- 3160
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...
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.Code:Ext.define('MyApp.view.AnimComp', { extend : 'Ext.Component', requires : [ 'Ext.Anim' ], ... });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.
-
8 Mar 2012 12:18 PM #3
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.
-
8 Mar 2012 12:22 PM #4
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".
-
8 Mar 2012 6:13 PM #5Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
- Answers
- 24
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


Reply With Quote