[PP-1] Allow setting aggregation groups for js files in library definitions

Created on 14 September 2021, over 3 years ago
Updated 20 August 2023, over 1 year ago

Problem/Motivation

Postponed on 📌 Replace custom weights with dependencies in library declarations; introduce "before" and "after" for conditional ordering Needs work

It is not possible to set an arbitrary aggregation group on JS assets.

The feature was removed when we switched to put all assets in libraries #1996238: Replace hook_library_info() by *.libraries.yml file with the idea that this shouldn't be used for ordering js files between each others because dependencies should be explicitly declared. This worked as intended, many if not all devs use libraries and declare their dependencies.

Not allowing to set a group now prevent us from making further optimisation possible (and it did at the time too #1996238-67: Replace hook_library_info() by *.libraries.yml file with less impact)

Proposed resolution

I think there are 2 steps:

  1. Enable the old behavior to make sure the perf hit of ckeditor5 is as small as possible
  2. Implement a proper solution (possibly reviewing the whole lifecycle of libraries, a few things are missing IMO)

The intent is for module developer to be able to set an aggregation group on their assets to bundle them independently from the other files as a performance optimisation, it might enable advagg to do some more fancy work too.

This will impact dependency resolution, a group can only be added below all the aggregated group dependencies (in case there are dependencies external to the aggregation group, like a script that depends on core/drupal or core/jquery within the group)

Remaining tasks

Agree and come up with the steps to get there.

API changes

Allow setting a group key in library definition, or something similar.

Feature request
Status

Postponed

Version

10.0

Component
Asset library 

Last updated about 14 hours ago

No maintainer
Created by

🇫🇷France nod_ Lille

Live updates comments and jobs are added and updated live.
  • JavaScript

    Affects the content, performance, or handling of Javascript.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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

    Adding the issue this is postponed on to the issue title because I couldn't figure it out until I read my own comment...

Production build 0.71.5 2024