Use the asset library dependency tree to improve CssCollectionGrouper & JsCollectionGrouper

Created on 19 August 2015, almost 9 years ago
Updated 21 August 2023, 10 months 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.69.0 2024