Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
So the CSS files are being loaded in wrong order when there is multiple themes. Lets say Seven has base theme classy the order at the moment would be Seven -> Classy.
Proposed resolution
Fix the order of the CSS files so that the base theme CSS files are being loaded before subtheme and that way the CSS on the base themes can be overrided in its child themes.
Remaining tasks
Write tests
Fix it
Test it
-> Profit!
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#8 | css_files_from_themes-2474091-8.patch | 317 bytes | lauriii |
Comments
Comment #1
star-szrI think this is major, specificity wars are no fun.
Comment #2
lauriiiI can take a look on this.
Comment #3
lauriiiI think this has been fixed by something else. I think I'll try to find that issue and make sure there is test coverage for this.
Comment #4
sqndr CreditAttribution: sqndr as a volunteer commentedIt's still broken. I'm working on a patch that demonstrates this being broken. I'll upload in a second.
Comment #5
sqndr CreditAttribution: sqndr as a volunteer commentedIt's still broken. I'm working on a patch that demonstrates this being broken. I'll upload in a second.
Update: So … if you don't remove the layout.css from classy (
'@classy/css/layout.css'
), it will be loaded in last, after the seven layout stylesheet.Comment #6
sqndr CreditAttribution: sqndr as a volunteer commentedHere's an example:
So … you'd expect the page to be pink (the color set in seven), while it's actually blue. The classy layout.css file is loaded last.
Comment #7
sqndr CreditAttribution: sqndr as a volunteer commentedComment #8
lauriiiSo this isn't as clear as it seems. There is different components css types such as base, component and theme. Base is loaded first and theme last and there and Bartik and Seven uses these clearly differently which causes this to happen.
Comment #9
lauriiiComment #10
jstollerPerhaps I'm confused, but shouldn't all the Css in a theme be loaded as "theme?" It doesn't seem like "base" would ever be an appropriate designation for theme styling.
Comment #11
joelpittet@jstoller base is for element styles (usually not classes), 'components' are for self contained parts of the page, like search form or login block and 'theme' is about providing colors and sizing on those components.
Does that help?
@see https://www.drupal.org/node/1887922
Comment #12
davidhernandezWhat Joel said. Also, I was just thinking about this. If we confirm what lauriii discovered (I didn't take the time to test it yet,) then we can probably close this issue. There is no need to rename the layout file. As soon as a worthy CSS file gets moved to Classy, like one of the System ones (#2395853: Split system.module.css and system.theme.css files into SMACSS style components,) we can use that for tests and get rid of layout.css.
Comment #13
davidhernandezP.S. Unless someone wants to use this to write tests around the ordering.
Comment #14
sqndr CreditAttribution: sqndr as a volunteer commentedI manually tested the loading order at DrupalCon LA. I create two simple themes, a base theme and a subtheme. I included stylesheets for all 5 SMACSS components. The order was correct. First the base from the base theme, then from the sub theme … same for rest of the categories.
Comment #15
davidhernandezI think we are seeing this work correctly now.
Comment #16
hass CreditAttribution: hass commentedFixed somewhere else.