PDA

View Full Version : How to use sencha-touch.js?



ThiemNguyen
10 Apr 2012, 1:31 AM
It seems to be a very easy question... I'd like to "compress" my app in production, so I want to know how to use sencha-touch.js to build only necessary classes for my application. Now I'm using sencha-touch-all.js so I almost know nothing about building process. :(
Thanks for any help.

mitchellsimoens
10 Apr 2012, 7:48 AM
During development you should use sencha-touch-debug.js . This has Ext.Loader enabled and allows you to load the classes that you require. In your application classes you should use the require methods so if a view requires Ext.TitleBar then you need to require it:


requires : [
'Ext.TitleBar
]

dzedward
10 Apr 2012, 10:10 AM
There's some info here http://docs.sencha.com/touch/2-0/#!/guide/building

Although I still haven't been able to get it to work, I always get warnings about 'Ext.Panel' and 'Ext.Container' even though I require them in each View. Good luck.

Is there no pre-built build of sencha touch 2 that just includes everything without having to dynamically load classes? Even if it's not custom to just any one app, at least its just a single file that has it all..

mitchellsimoens
10 Apr 2012, 10:19 AM
I have no issues using Sencha Command (the preferred way now). http://docs.sencha.com/touch/2-0/#!/guide/command

ThiemNguyen
12 Apr 2012, 3:06 AM
Thanks for your replies.
Another question, will my application become slower in performance (I don't mean initial loading time) if I use sencha-touch-all.js instead of sencha-touch.js?

mitchellsimoens
12 Apr 2012, 4:36 AM
Thanks for your replies.
Another question, will my application become slower in performance (I don't mean initial loading time) if I use sencha-touch-all.js instead of sencha-touch.js?

Startup time will be slower (compared to after doing a build). Should be the only difference.