Problem/Motivation
A subtheme of a subtheme is reading styles in an unexpected order
in this case,
-- bootstrap5
---- bcbb_theme
------dc_theme
The expectation is that dc_theme will have priority over bcbb_theme, and bcbb_theme will have priority over bootstrap5
if enable and set dc_theme as default, it's reading styles from bootstrap5 before bcbb_theme, so thebcbb_theme styles are being overwritten.
if I enable bcbb_theme and set as default, it works as expected. Styles from bcbb_theme are applied and override whatever is in bootstrap.
Steps to reproduce
- Create a subtheme of
bootstrap5calledbcbb_theme, verify in bcbb_theme.info.yml the line'base theme': bootstrap5. - add some css to test with, say
body {background: yellow} - set
bcbb_themeas the default theme - go to the home page
- See that the page background is yellow
- Create a subtheme of
bcbb_themecalleddc_theme, verify in dc_theme.info.yml the line'base theme': bcbb_theme. - set
dc_themeas the default theme - go to home page
- see that the background is not yellow
- open dev tools
- see that body styles in /themes/contrib/bootstrap5/css/style.css is being used over body styles in /themes/contrib/bcbb_theme/css/style.css
bootstrap5 and bcbb_theme are both in themes/contrib, dc_theme is in themes/custom.
Expected behaviour
Having default theme as bcbb_theme or dc_theme will show a yellow background in the example above.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | style-css-file-order.png | 304.85 KB | ravi kant |
Comments
Comment #2
liam morlandComment #3
crow commentedComment #4
abyss commented@crow This issue is probably a mistake because your second sub-themes have body styles that have the "background-color: var(--bs-body-bg);" parameter. This parameter overrides the background color that was set in the first subtheme.
Comment #5
ravi kant commented@crow
I followed the same method as described but I am getting yellow color in my sub-sub-theme.
Theme bootstrap5 style.css is not in use in my case. Only subtheme and sub-subtheme styles displaying.
Also, yellow background color is displayed in the sub-subtheme which I was set subtheme.
Attaching screenshot.
Comment #6
jannakha commentedyou shouldn't be loading sub-theme if there's a sub-sub-theme
all sub-theme styles should be incorporated into sub-sub-theme - so you have just one style
Comment #7
liam morlandI think it is supposed to be that any theme can have a sub-theme made off it and everything from all ancestor themes continues to work.
Comment #8
jannakha commentedYes, but you should load all of css from all 3 themes - it’s like loading bootstrap 3 times!
If templates are overridden in subtheme, they’ll be used in subsubtheme unless overridden in subsubsub theme.
Are you still having issue with this?
If yes - what exactly is an issue? Which files are not loading? can you provide more details on the sub-themes and configuration? (Screenshots or zip files)?
Comment #9
ressaSince there has been no response, perhaps we can close this issue? Feel free to re-open, if this is still a problem.