26 Dec 2012 4:39 PM #1
Changes to organization of Ext JS Themes in Cmd 3.0.2
See also http://www.sencha.com/forum/showthre...-Now-Available
The guides will be updated soon. The holidays create challenges there but then again I imagine relatively few people will be looking at this for this time period.
Here is an excerpt from the new theme guide to describe the "themes as packages" structure. This will be further expanded in Cmd 3.1 but 3.0.2 should get themes reorganized along this path and that should carry forward well for future releases.
For many reasons, we want the Sencha Cmd tooling to be an enabler for people to create and ultimately share themes. The previous organization of a theme (inherited from Ext JS 4.0) made that difficult as there was no single root folder that contained all of that theme and only that theme.
In Cmd 3.0.2 and forward, themes are now contained in folders of their own in the "packages" folder. The theme formerly named "default" was renamed the "theme" package. So "resources/sass/default/app.scss" moves to "packages/theme/sass/app.scss".
resources/ # Contains SASS source code and additional resources images/ # General image content (optional) ... theme/ # The compiled form of the default "theme" images/ # Unified image content generate by build process app.css # The compiled theme red/ # The compiled form of other themes (by name) images/ app.css packages/ # Contains themes (the only packages for now) theme/ # The default theme (you can generate more here) images/ # Optional folder (content is copied if it exists) sass/ # sass input files for the default theme config.rb # Compass configuration file app.scss # Root SASS source for theme slice-src/ # Generated code for slicing (used by theme.html) ... # See below for description of these files theme.html # Web page for visual inspection and image slicing ... red/ # Other generated themes ... # Contents are the same as the default "theme" build/ # Build output appName/ # Build output for app production/ # Build output for "sencha app build production: resources/ # All files from "resources" folder .... testing/ # Build output (env = "production", "testing", etc.) ....
The image build process for a theme is in 3 steps to produce the final content of "resources/theme-name/images":
- Copy in the images from the base framework theme.
- Generate image "slices" from the CSS3 rendering for use in IE (using "packages/theme-name/theme.html" and related files)
- Copy in the content of "package/<theme-name>/images" (if it exists).
28 Dec 2012 8:58 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
If you get 404 on your images when you generate a new theme, you can do this command in the app dir to move the images into your theme's images dir:
sencha theme build [theme-name]Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
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 firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
28 Dec 2012 1:32 PM #3
Good point - you will also need to run
sencha app build
1 Jan 2013 9:49 AM #4
I downloaded Cmd 3.0.2 and was able to create a custom theme perfectly except for 1 thing. The Panel headers continue to use the default theme blue gradient only in IE6-IE9. It works perfectly in Chrome, Firefox and Safari. To illustrate this better I used really dark colors so I could easily see how each element in the theme was being affected. I found this a really good way to learn how to build custom themes.
Here is an example of what it looks like in Chrome, Firefox and Safari.
When I run it in IE9 everything works except the Panel header (which also seems to affect the button rollovers too).
I have everything working in the new packages folder using sass (which by the way is a much better design). I ran the following commands to generate and build the theme and get no errors.
sencha theme build -p packages/newtheme/theme.html -o packages/ newtheme /images -image packages/ newtheme /image.png -data packages/ newtheme /data.json
sencha theme build -t newtheme
I have tried this on much more complex views and everything works except for the Panel header background in IE9. I can see all the sliced images in the images folder so I know the slicing is working too it just seems like this one piece is missing.
1 Jan 2013 4:03 PM #5
I was able to figure this out. It turns out that IE9 does not always refresh 100% and the only way to completely refresh it is to close and reopen IE9. That was throwing me because Firefox, Chrome and Safari all refresh and show the updates CSS without closing.
Another thing I had to do was set more of the SASS variables. For anyone else that is interested here are that changes to get the Panel header to change.
$panel-header-background-gradient: color-stops($dark-blue, $dark-blue);
$panel-header-font-weight: normal !default;
29 Jan 2013 5:00 AM #6
Step-by-step instructions for creating new workspace with multi-apps and shared theme
I'm a bit confused. Does the new package structure allow multiple apps to share a single (global) theme? as per this discussion http://www.sencha.com/forum/showthread.php?245718
If so please advise on steps to setup. On windows I have:
cd \ sencha -sdk ext-4.1.1a generate workspace dev\test sencha -sdk ext-4.1.1a generate app TestApp dev\test\app\testApp cd dev\test sencha generate theme foo
[ERR] Failed to determine framework path. Please ensure this command was issued from either a framework or application directory
I was expecting to create:
Are you still recommending that we create a "theme app"?
29 Jan 2013 5:51 AM #7
Actually, might I suggest the following instead. Please setup a walkthrough as follows:
Target webapp design:
- A simple webapp consisting of 3 pages with a static navigation header for switching between the pages.
- The main content area of each page will be generated by an ExtJS app
- All extjs apps will share a common theme
| Menu = App1 App2 App3
| content generated
| by extjs App1,2,or 3
| depending on which menu link
| is clicked
Steps in the walkthrough
- The walkthrough will use senchacmd to generate the workspace and 2 apps (initially)
- Coding the apps can be skipped - just pick 3 apps from the examples - e.g. a chart, grid, and a tree control
- An opensource theme (like http://bootstrap.newbridgegreen.com/) is added to the workspace - senchacmds / any customisation to theme are shown
- Show how to build and view the 2 generated apps, and show that they are using a shared theme
- A 3rd app is added - sencha cmds are shown and we see how to change the 3rd app to make use of the global theme
- We can now load the final built app and switch between the 3 extjs apps / pages
- Source code is provided for download
1. It will succinctly demonstrate senchacmd usage
2. It will provide a reference architecture/template for developers for what I believe must be the most common webapp design pattern
3. It will provide a base test app which future theme developers can drop their themes into, and help pave the way for future outsourcing of theme design by developers
4. No doubt the structure of extjs workspaces/apps and the senchacmd will evolve - this will give you an easy way to explain the changes
31 Jan 2013 4:31 AM #8
9 Feb 2013 1:42 PM #9
@IlanCopelyn - That is great work. Thanks for sharing it with folks!
The changes to this structure in 3.0.2 were to prepare the way for a resolution to this issue of theme creation and sharing. This will be available very soon as part of the Ext JS 4.2 beta with the introduction of Sencha Cmd 3.1.
We are still ironing out the details of this as it relates to Ext JS 4.1.x because to make this really work well we needed to change the structure of our SASS and resources to be more like what you see in Cmd 3.0.2. This probably means that the upcoming beta of Cmd 3.1 will not have improvements in this area for Ext JS 4.1.x apps but perhaps we can find a way to share some of that with the old theme structure for 3.1 GA.
10 Feb 2013 3:00 PM #10
OK, I can now create a new theme but I am still confused. If I create a theme (say "red") other than the default one in the packages directory, how is that theme used? I see it gets build during the
sencha app build