Theme stylesheet documentation is out of date

Created on 18 August 2022, over 2 years ago
Updated 8 July 2024, 6 months ago

Problem/Motivation

Spotted while working on ๐Ÿ“Œ Remove Bartik from Drupal core Fixed we have some code comments that I'm sure are out of date:

\Drupal\Core\Asset\AssetResolverInterface says:

   * Themes may replace module-defined CSS files by adding a stylesheet with the
   * same filename. For example, themes/bartik/system-menus.css would replace
   * modules/system/system-menus.css. This allows themes to override complete
   * CSS files, rather than specific selectors, when necessary.

I'm pretty sure this is no longer true - instead, modules and themes must declare libraries and you can override a library in a theme.

\Drupal\Core\Extension\InfoParserInterface says:

   * Information stored in a theme .info.yml file:
   * - screenshot: Path to screenshot relative to the theme's .info.yml file.
   * - engine: Theme engine; typically twig.
   * - base theme: Name of a base theme, if applicable.
   * - regions: Listed regions.
   * - features: Features available.
   * - stylesheets: Theme stylesheets.
   * - scripts: Theme scripts.

I don't think stylesheets or scripts work any more, again replaced by libraries, and there are definitely some things missing from this list too.

\Drupal\Core\Extension\ThemeHandlerInterface says:

   *   An associative array of the currently installed themes. The keys are the
   *   themes' machine names and the values are Extension objects having the
   *   following properties:
...
   *   - stylesheets: A two dimensional array, using the first key for the
   *     media attribute (e.g. 'all'), the second for the name of the file
   *     (e.g. style.css). The value is a complete filepath (e.g.
   *     themes/bartik/style.css). Not set if no stylesheets are defined in the
   *     .info.yml file.
   *   - scripts: An associative array of JavaScripts, using the filename as key
   *     and the complete filepath as value. Not set if no scripts are defined
   *     in the .info.yml file.

Same as above.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Themeย  โ†’

Last updated 19 minutes ago

Created by

๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom longwave UK

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024