Use the asset library dependency tree to improve CssCollectionGrouper & JsCollectionGrouper

Created on 19 August 2015, about 9 years ago
Updated 21 August 2023, about 1 year ago

Problem/Motivation

When aggregating CSS & JS assets, the grouping is hugely important. Drupal 8's current grouping algorithm is old, and often results in inefficient groups.

Proposed resolution

Paraphrasing from #977844-15: Remove the 'every_page' option for CSS/JS assets: it is confusing, even damaging :
Every single asset in Drupal 8 is now loaded through asset libraries. That also means we know about all dependencies. Which means we can build a dependency tree, and thus we can calculate which assets appear on every page, and put those in a separate group.

Remaining tasks

TBD

User interface changes

None.

API changes

None.

Data model changes

None.

📌 Task
Status

Active

Version

11.0 🔥

Component
Asset library 

Last updated 1 day ago

No maintainer
Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Not all content is available!

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

  • 🇬🇧United Kingdom catch

    For CSS, I was thinking about this issue, but then found Allow CSS to be added at end of page Active and I think that would help here - i.e. placeholdered content gets it's CSS asset links rendered alongside it, instead of collected and eventually rendered in the head.

    That would give us less libraries rendered in the HTML head, meaning less render blocking CSS. We'd still want to optimize the grouping but the results would be very different.

  • 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

    👍

    Note that we already do this, and have been for over half a decade, in one case: BigPipe serving responses to no-JS clients.

Production build 0.71.5 2024