Problem/Motivation

Split from #3467488: [13.x] Remove support for per-file weight in libraries API. We need an easily backportable change to ignore weights in 11.x for modules like blazy that set custom weights against core libraries that no longer have custom weights (and end up too early).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3642203

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

catch created an issue. See original summary.

catch’s picture

Status: Active » Needs review
alexpott’s picture

This looks much easier to commit to 11.5.x - nice.

So I'm concerned that we're still going to respect any weights set in the alter functions because of how we call the alters before we call the sort...

Eg.

      // Allow modules and themes to alter the JavaScript assets.
      $this->moduleHandler->alter('js', $javascript, $assets, $language);
      $this->themeManager->alter('js', $javascript, $assets, $language);

      // Sort JavaScript assets, so that they appear in the correct order.
      uasort($javascript, [static::class, 'sort']);

If we really want to completely disable sorting by weight I think we need to update \Drupal\Core\Asset\AssetResolver::sort() to determine the CSS category based sorting and completely remove the weight sorting from it.