- Issue created by @catch
📌 Replace custom weights with dependencies in library declarations; introduce "before" and "after" for conditional ordering Needs work 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 📌 Remove separate CSS_AGGREGATE_THEME aggregate file Needs work to consider.
Active
11.0 🔥