Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291377

Core and base theme CSS files in libraries override theme CSS files with the same name

$
0
0

Problem/Motivation

During #2375673: Split Bartik's CSS into SMACSS style components we've found that if we add a CSS file to a library with a name that already exists, that CSS never loads. It seems like the core CSS is overriding the theme CSS. This is a big WTF for themers.

We already have created way to override CSS files #575298: Provide non-PHP way to reliably override CSS but it has to be refactored because its designed to remove single file. If this functionality wouldn't be redesigned people would unintentionally override multiple files which has the same name.

Proposed resolution

Don't override CSS files that have the same name, let them to live in peace together. Stylesheet-override and stylesheet-remove has to be rethinked to make it work with multiple instances of files having same name.

libraries-remove
The ability to remove entire libraries.

  libraries-remove:
      - subtheme/library
      - core/modernizr

libraries-override
The ability to override entire libraries and parts of libraries:

    libraries-override:
      # Replace an entire library.
      core/drupal.collapse: mytheme/collapse
      # Replace one particular library asset with another.
      subtheme/library/css/theme/css/layout.css: css/layout.css
      # Remove one particular asset.
      drupal/dialog/css/theme/dialog.theme.css: false

Note that we could even omit libraries-remove if we'd allow

    libraries-override:
      # Remove an entire library.
      core/modernizr: false

Or we could go even further:

  1. a libraries-extend property in theme *.info.yml files:
    libraries-extend:
      contextual/drupal.contextual-links:
        css:
          theme:
            mytheme-fancy-contextual-links.css
        js:
          mytheme-fancy-contextual-links.js

    … to attach additional CSS/JS to existing libraries (if those existing libraries are present)

  2. a attach-library-to-hook property in theme *.info.yml files:
    attach-library-to-hook:
      menu_local_action:
        - core/modernizr
      block___menu:
        - mytheme/fancymenublock

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue categoryBug
Issue priorityCritical because an important part of the theme system is not working properly.
DisruptionThis should not be disruptive. A bug is being fixed, but no API is changed.

Viewing all articles
Browse latest Browse all 291377

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>