Warp6 Styles
We introduce a new feature similar to child themes
We started this week with a closer look at the overall Warp6 framework structure. Today we want to introduce a new feature called "Styles" which relates to the framework structure. So if you missed the latest article you can read it here: Inside the Warp6 Framework.
Styles
Styles are variations of the default theme and are similar to the concept of child themes in Wordpress or sub themes in Drupal. A style defines a layer after the default theme and can inherit or override resources from the parent default theme. We implemented this by using the file cascade we described in the previous blog post. Warp6 looks first in the specific style folder and loads the file if it's found. Otherwise it looks what's next in the cascade. This gives you full flexibility to override any file of the default theme. Each style is placed in its own directory in the themes /styles folder and can provide its own custom HTML layouts, CSS, JavaScript and images. Let's take a look at this feature in the following example.
Example
Let's create a new style we call "fresh". To do so we have to create a new style folder /styles/fresh. That's it! We created a new style which looks the same like our default theme.
We can override the default layout /layouts/template.php file, by putting a new layout file right here /styles/fresh/layouts/template.php. Now you can start customizing it.
Next you can add your own CSS /css/layout.css file, by copying it to /styles/fresh/css/layout.css. The "fresh" style would now load it's own layout style sheet. But what if you only have one small modification? For example you just want to change one color. Do you have to copy the whole layout CSS from the default theme? No, just import the /css/layout.css by using @import url(../../../css/layout.css); and add your small modification. You have full control which CSS assets you want to include from the default theme, from the core framework or neither. This means no bloated code! Isn't this great?
This way you can inherit or override any resource from the default theme like the StyleSheets, JavaScript module or system markup files.
What's so great about it?
The styles feature introduces a new way of customizing a theme and makes it easy to create theme variations. All styles benefit from inheriting layouts and assets from the main theme, which allows to create minor customizations really fast.
This is the new recommended way to customize themes. You can create your own style or just start off by copying an existing one. The style variations are modular and separated from the main theme so it's the perfect place for your theme customizations. This way a theme can be updated without merging all your customization to the updated template.
We even use the style approach to create the Warp6 mobile theme which is optimized for all mobile devices. The mobile style has it's own specific HTML markup, CSS rules and JavaScripts which are necessary to display the mobile theme version.
Next week we will take a closer look at the new HTML5 markup and the new CSS framework.
Related blog posts:
Warp6 Error Pages
Warp6 Mobile Theme
Warp6 Administration
Warp6 CSS Framework
Warp6 and HTML5
Inside the Warp6 Framework
Warp6 Announcement

Comments (15)
magicspon
kyle.faber
domeniconi.marco
Great for proposing different styles to clients in the webdesign process
sascha
hubumedia
Is this new styles system better suited for doing those complete and total modifications rather than modifying the template files directly? I am concerned about having code bloat, double files for everything when I am overriding so much of the template.
Jordan
houston
Easy solution for us would be different types of updates: core, css or combined. Or at least a detailed note which files have been updated and if css is involved at all.
sascha
houston
sascha
lovinWarp
sascha
alxttr
In the actual menu system, if your last menu item is positioned close to the right side and your submenu is split in 2, 3, 4 columns then it depasses the template width... making it look kind of un-natural...
Roman
ASa