Contrary to the documentation, subtheme does not override a base theme file having the same name

Created on 27 November 2023, 11 months ago

Problem/Motivation

Documentation at https://www.drupal.org/docs/7/theming/creating-a-sub-theme states that:

All style sheets defined in the parent theme will be inherited.

Overriding inherited style sheets: Specify a style sheet with the same filename in the sub-theme. For instance, to override style.css inherited from a parent theme, add the following line to your sub-theme's .info file:

stylesheets[all][] = style.css

You will also need to create the style.css stylesheet file; if you simply wish to disable the imported styles, you can create an empty file.

The part in bold is not true. For some strange reason, base theme's css file takes precedence over subtheme's css file.

Steps to reproduce

Create a base theme with a file mycss.css
Create a subtheme with a file mycss.css
You should notice that base theme's file is picked up instead of subtheme's one.

Proposed resolution

Fix the bug either in code or in documentation.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Closed: works as designed

Version

7.0 ⚰️

Component
Theme 

Last updated about 11 hours ago

Created by

🇫🇷France anrikun

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024