Problem/Motivation

After Drupal 10.4 update we noticed that CSS assets are loaded in wrong order which could then mess with CSS styling, because CSS rules are in different order and rules with same specificity will be applied/overridden in different way.
Before D10.4 first CSS global theme assets were loaded and then conditional assets from components. After D10.4 the order was mostly other way around with some other changes.

The issue is coming from core change in #3467860: Ensure consistent ordering when calculating library asset order. After discussion with @berdir and @catch on slack @berdir proposed that we solve this by introducing weights definition in our components libraries. There is a core issue #3467488: Deprecate support for per-file weight in libraries API that is proposing to remove weights for D11, but until that is done we can use weights and later switch to new dependencies before/after definitions as per #1945262: Introduce "before" and "after" for conditional ordering in library definitions issue that is for now also planned for D11.

This needs to be fixed also in bs_base theme and in any custom child theme if it defines custom components css libraries.

Issue fork bs_lib-3490049

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pivica created an issue. See original summary.

pivica’s picture

Status: Active » Needs review

pivica credited berdir.

pivica credited catch.

pivica’s picture

  • pivica committed 4054800e on 8.x-1.x
    Issue #3490049 by pivica, berdir, catch: Wrong order of CSS assets after...
pivica’s picture

Status: Needs review » Fixed

Merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.