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

  1. Create a subtheme of bootstrap5 called bcbb_theme, verify in bcbb_theme.info.yml the line 'base theme': bootstrap5.
  2. add some css to test with, say body {background: yellow}
  3. set bcbb_theme as the default theme
  4. go to the home page
  5. See that the page background is yellow
  6. Create a subtheme of bcbb_theme called dc_theme, verify in dc_theme.info.yml the line 'base theme': bcbb_theme.
  7. set dc_theme as the default theme
  8. go to home page
  9. see that the background is not yellow
  10. open dev tools
  11. 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.

CommentFileSizeAuthor
#5 style-css-file-order.png304.85 KBravi kant

Comments

crow created an issue. See original summary.

liam morland’s picture

Title: Subtheme of subtheme is not reading styles in the expeted order » Subtheme of subtheme is not reading styles in the expected order
Version: 3.0.7 » 3.0.x-dev
crow’s picture

Issue summary: View changes
abyss’s picture

@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.

ravi kant’s picture

Status: Active » Needs review
StatusFileSize
new304.85 KB

@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.

jannakha’s picture

Status: Needs review » Closed (works as designed)

you 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

liam morland’s picture

I 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.

jannakha’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

Yes, 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)?

ressa’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Since there has been no response, perhaps we can close this issue? Feel free to re-open, if this is still a problem.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.