Problem/Motivation

#1945262: Introduce "before" and "after" for conditional ordering in library definitions fixes core libraries so that they no longer depend on individual file weights, but instead on declaring correct dependencies between each other.

The next step is to deprecate weight support in the assets API.

For JavaScript we should be able to just issue a deprecation message and then remove support.

For CSS, 'weight' and 'group' are conflated, see:

LibraryDiscoveryParser.php

foreach ($library[$type] as $category => $files) {
            $category_weight = 'CSS_' . strtoupper($category);
            assert(defined($category_weight), 'Invalid CSS category: ' .        $category . '. See https://www.drupal.org/node/2274843.');
            foreach ($files as $source => $options) {
              if (!isset($options['weight'])) {
                $options['weight'] = 0;
              }
              // Apply the corresponding weight defined by CSS_* constants.
              $options['weight'] += constant($category_weight);
              $library[$type][$source] = $options;

So that is going to need a bit more thought.

There is also #1924522: Remove separate CSS_AGGREGATE_THEME aggregate file to consider.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

catch created an issue. See original summary.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

catch’s picture

Title: Deprecate support for per-file weight in libraries API » [PP-1] Deprecate support for per-file weight in libraries API
Priority: Normal » Major

We can deprecate per-file weights without resolving the CSS group issue, just won't be able to remove the weight concept entirely from the asset system, but that can be another follow-up once this is done. For example we could sort directly by the CSS group constants rather than converting them to weights.

catch’s picture

Title: [PP-1] Deprecate support for per-file weight in libraries API » Deprecate support for per-file weight in libraries API
catch’s picture

catch’s picture

Title: Deprecate support for per-file weight in libraries API » [PP-x] Deprecate support for per-file weight in libraries API
Status: Active » Postponed

I think we can do the actual deprecation here once we've removed weights in the child issues.