Thursday, April 10, 2014

Using Sencha CMD 4.0.2 Architecture for ST2

So you have a ST2 project that's all big and uncompiled, and you want to minify it with CMD and even port it to XCode.

Here's how.

You should already have an MVC architecture, with models, views, and controllers separated into separate folders.

Get Sencha CMD4 and perform
sencha -sdk /path/to/sdk generate app AppName /app/folder/

If everything's working, cmd should create an app under /app/folder with a ton of goodies in it.
Check out it's folder structure and stuff. To change themes, access the hidden .sencha folder.

Just for satisfaction, run
sencha app build

There should now be a build folder in your project directory. Go look inside and find the minified code. Hooray!
Now, simply migrate your MVC code into the /app folder generated by cmd.
Run the app build command again. Given your code is structured correctly, and you have made all the proper changes to the app.js file, everything should work.

You now have a minified js and css file! Awesome!

For the phonegap component: check out this website http://www.sencha.com/blog/getting-started-with-sencha-touch-2-build-a-weather-utility-app-part-3
For the tl;dr version, do
sencha app build production 
sencha phonegap init <APP-ID> <APP-NAME>

Now, you should have a phonegap folder, and config.xml file. Check out the config.xml and read it, and make all the obvious changes that you need to make.

Finally, run a
sencha app build native

You should find the /phonegap/platforms/ios folder, inside of which will be an xcode project.

Please comment if you have questions!

No comments:

Post a Comment