Quick Touch 2 scaffolding example

Desculpe-nos, mas este texto está apenas disponível em English.

The new Sencha Touch 2 framework ships with a terminal SDK that makes it easier than ever to create, pack and deploy your application. Let’s take a look on how we start a brand new project with Touch 2.

First of all, make sure you check the official guide Using Sencha Command. It will help you have everything setup.

Scaffolding a new project requires a simple command.

sencha app create <namespace> <path_to_project>

The trick here is that you need to be at the sencha framework folder to execute this line. If you execute sencha app create from any other folder, it won’t work.

$ cd sencha-touch-2.0.0-gpl
$ ./command/sencha app create Blog ~/Code/BlogProject
[INFO] Created file /Users/brunotavares/Code/BlogProject/.senchasdk
[INFO] Created file /Users/brunotavares/Code/BlogProject/index.html
[INFO] Created file /Users/brunotavares/Code/BlogProject/app.js
[INFO] Created file /Users/brunotavares/Code/BlogProject/packager.json
[INFO] Created file /Users/brunotavares/Code/BlogProject/app.json
[INFO] Created file /Users/brunotavares/Code/BlogProject/app/view/Main.js
[INFO] Copied dir: /Users/brunotavares/Code/BlogProject/sdk/src
[INFO] Copied dir: /Users/brunotavares/Code/BlogProject/sdk/resources
[INFO] Copied dir: /Users/brunotavares/Code/BlogProject/resources/icons
[INFO] Copied dir: /Users/brunotavares/Code/BlogProject/resources/loading
[INFO] Copied dir: /Users/brunotavares/Code/BlogProject/sdk/command
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/sdk/microloader/development.js
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/sdk/microloader/testing.js
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/sdk/microloader/production.js
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/sdk/version.txt
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/sdk/sencha-touch.js
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/sdk/sencha-touch-all.js
[INFO] Created file /Users/brunotavares/Code/BlogProject/resources/sass/app.scss
[INFO] Created file /Users/brunotavares/Code/BlogProject/resources/sass/config.rb
[INFO] Copied file: /Users/brunotavares/Code/BlogProject/resources/css/app.css

And now you can open your local server (e.g. http://localhost/code/BlogProject/) and see a ready-to-code application.

It’s fairly simple to start a Touch application with this kind of tool. It’s just download the framework, open the terminal, and execute one app create command.

The resulting app will have an ideal structure. It will make use of the new microloader, that under production keeps files on localstorage for better performance. It will have the MVC structure in place, that provides a solid and maintainable foundation. It will also create the packager.json file, that will help us pack this app for native iOS or Android distribution.

With this in place, we can now go ahead and develop some cool apps in the next posts!

LinkedInDeliciousPinterestTumblrEmailShare