-
11 Jan 2012 2:42 AM #1
Deployment Best Practices
Deployment Best Practices
Hi,
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 #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
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.
It can be any class, not just other view components.Code:Ext.define('MyView', { .... requires : [ 'Ext.TitleBar', 'Ext.dataview.List' ], .... });
For controllers, you should specify your controlleres in your Ext.application:
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 viewsCode:Ext.application({ .... controllers : [ 'Main' ] .... });
Within a controller you can specify the models, stores, and views array:
Just like in Ext.application, it will prepend <name>.model, <name>.store, <name>.view to those classes depending which property it is in.Code:Ext.define('MyContoller', { .... models : [ 'User' ], stores : [ 'Users' ], views : [ 'Users' ] .... });
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.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.
-
11 Jan 2012 3:17 PM #3
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/packag...ncha-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 #4
Ext.Require placement
Ext.Require placement
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 #5Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,582
- Vote Rating
- 433
Before the Ext.application call
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.


Reply With Quote