I found many resources that talked about the themes but none gave very good instructions on how to make them work. I finally found a video that walked you through some of the process involved in making themes work. It left out some important stuff that I found through lots of trial and even more error.
I'll show you how to apply a theme to the default sencha project. You can apply these steps to your own project.
- Create an example app.
- sencha -sdk [path to sdk] generate app [AppName] [path]
- You'll need to create scss files for the different platforms you want to support.
- cupertino.scss (iOS 7 styling)
- cupertino-classic.scss (iOS 6 styling)
- mountainview.scss (Android)
- Each of these files will include two imports lines that define our theme styles.
@import 'sencha-touch/[platform name]';@import 'sencha-touch/[platform name]/all';
[platform name] is the name of the style you're including. cupertino.scss will use "cupertino" and mountainview.scss will use "mountainview". All the platform names are available here under tip 2. - Next you'll need to run "compass compile" or "compass watch" in the resources/sass folder.
- Now we have to update app.json to include the new css files that were generated by compass. Look for the css option and add each platform as an object to the css array.{"path": "resources/css/cupertino.css","platform": ["ios"],"update": "delta"}
Make sure to update the platform value with the appropriate value. The options are available here under available platforms.
IMPORTANT NOTE: Make sure to add the "platform": ['desktop'] to the app.css entry. If you don't app.css will be included in every theme and it will break the display. - Lastly you'll need to run sencha app build to bring everything together. You can test the different templates by appending ?platform=[platform name] to your uri.
eg: senchaapp.io/?platform=ios
I've added the example project to github so you can pull that down as an example.
No comments:
Post a Comment
If you found this page useful, or you have any feedback, please leave a comment.