View Full Version : Deployment Best Practices
11 Jan 2012, 2:42 AM
For an MVC structured Touch application, whats the best way of deploying the script files that reside in the model, view and controller folders? Can you for example minify them into one js file or do you have to minify each separately and they stay in those folders?
I hope this makes sense!
11 Jan 2012, 6:51 AM
There will be tutorials on this for the next release.
For views, it is best to put all required classes that that view uses in the requires array property.
requires : [
It can be any class, not just other view components.
For controllers, you should specify your controlleres in your Ext.application:
controllers : [ 'Main' ]
It will interate through that and prepend the name of your app (<name>) and controller: <name>.controller.Main. You can do the same with model, stores, and views
Within a controller you can specify the models, stores, and views array:
models : [ 'User' ],
stores : [ 'Users' ],
views : [ 'Users' ]
Just like in Ext.application, it will prepend <name>.model, <name>.store, <name>.view to those classes depending which property it is in.
You can use the requires in Ext.application, any of your controllers, models, stores, and views. The class you are extending (or overriding) will automatically be required.
If you need things loaded upfront, you can use Ext.require and pass in a class name string or an array of class name strings. One thing to note is the path for your Ext.application is not entered so if you Ext.require a class that stems from your application's name, the path will be unresolvable.
11 Jan 2012, 3:17 PM
I found this link helpful. It describes how to use Sencha's SDK tools to consolidate/minify all of your application files into one file. http://robertdougan.com/posts/packaging-your-sencha-touch-2-application-using-the-sencha-sdk-tools
I ran into a few problems where the path to some files was incorrect, but I fixed it by revising my folder structure and changing the paths in my app.jsb3 file.
11 Jan 2012, 4:50 PM
Quick follow up question: Where exactly is the best place to put the Ext.Require(), when you want to load things upfront?
11 Jan 2012, 4:53 PM
Before the Ext.application call
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.