Wrong order of CSS assets after D10.4 update

Created on 26 November 2024, 28 days ago

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 🐛 Logic error in Drupal's lazy load for asset aggregation Active . 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 📌 Deprecate support for per-file weight in libraries API Active 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 📌 Replace custom weights with dependencies in library declarations; introduce "before" and "after" for conditional ordering Needs work 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.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇷🇸Serbia pivica

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024