Milo W.:
1. In Eclipse (+SDK) create a new theme (I will refer to it as theme01). This theme is made from styled and unstyled.
A theme can only have 1 parent. So you would have styled as the parent theme for theme01. Since unstyled is the parent of styled, you'll get the effect of "made from styled and unstyled", although since the parent is styled the unstyled is not really considered.
2. I create another theme (let's say theme02) but this time I edit build.xml and put theme01 as the parent.
Actually the parent theme in build.xml would be "../theme01". Just trying to be clear...
But how does theme02's folders behave? Do they inherit the 'original' folders from theme01 (so going back - > it's all styled and unstyled from the original themes) and just add changes from _diffs inside theme02? What about _diffs in theme01? Are they ignored?
The build of a theme is always the same: all of the files from the parent theme, and any overrides/additions from _diffs in their place.
So the build of theme01 is "styled" files, but overrides/additions from the theme01 _diffs folder. The result of this is the theme01 build.
Theme02 then becomes the "theme01" build but overrides/additions from the theme02 _diffs folder.
So it's like a channel, right?
Not quite.
"styled" theme build is "unstyled" build + styled's _diffs folder.
"classic" theme build is "styled" build + classic's _diffs folder.
theme01 theme build is "styled" build + theme01's _diffs folder.
theme02 theme build is "theme01" build + theme02's _diffs folder.
So it's like this "root" of the theme is being copied all the way from styled and unstyled?
Sort of, but not necessarily. If you start a "theme03" which has "../theme02" as the parent, then the theme03 build is the "theme02" build + theme03's _diffs folder. This is where things get hairy. If you go to theme01's _diffs folder and make some changes, but do not build theme01 or theme02, when you do the build of theme03 it is only based upon the current theme02 build, not the updated one that would be available if you'd done all of the builds.
That's why the use of the word "inheritance" doesn't really apply, because changes in the base do not have to percolate all of the way to the end of the chain.
And I just edit the themes by manipulating with _diffs folder?
You have to. If you put changes directly in the docroot folder, when the ant build script runs it first copies files from the parent theme. Thus your changes are overwritten from the parent. The only way to get your changes to apply is to put them in the _diffs folder.
The question: Does theme02 take changes from _diffs in theme01?
No, theme02 uses the theme01 build. If you've made changes in theme01's _diffs folder but did not complete a build, they have not been merged in yet and therefore would not percolate into theme02 during the build.
What I mean is the following way the CSS is created:
1. css from theme01 (copied previously from styled and unstyled)
2. diffs from theme01 override the above
3. theme02 takes from theme01... and now what - theme02 takes _diffs from theme01? If so, does it take any other folders? Or are the 'original' folders always the same, nothing inherited?
Hopefully I've explained the way that theme02 is built; it ignores anything in theme01's _diffs folder, and only uses the theme01 build.
In the above examples - should I not, at any time, change any folders (css, templates, images) which are not in _diffs?
Correct, because they can be overwritten when the build occurs.
So ...any theme can be parent and it doesn't have to be in the same folder as styled, unstyled, classic? It's just a matter of giving proper path in build.xml, right?
It should never be in the same path, nor should it have the same name as styled, unstyled, or classic.
When I have a custom theme and change it, I create "css" folder. Then I put e.g. layout.css. The question is: Does Liferay totally ignore the original layout.css and takes everything from _diffs/css/layout.css (so e.g. If I forget about something, it isn't styled according to my needs)? Or does it replace the exact definitions?
If you put a blank layout.css in the _diffs/css folder, the build of the theme will have a blank layout.css. Liferay will not look to any other layout.css (hence no inheritance again), so the missing layout stuff will cause Liferay to render improperly.
As for custom.css - it takes the individual declarations of css styles, right?
So for whole files between oryginal files and _diffs - it's the whole files.
For _diffs/css/custom.css versus _diffs/css/other-css-files - it's individual styles.
The css/main.css file is the key. If you have a _diffs/css/main.css that does not have any imports (had all of the necessary style definitions right in that file), you can have all of the custom.css or other-css-files you want and they would never be used (because the parent theme doesn't import other css files, so as a child your files wouldn't be imported either).
I find it hard to get this overall image of what is when and where inherited.
Just check out the output of the ant build script. You'll see what is going on during a theme build and what is done.
Please sign in to flag this as inappropriate.