- Issue created by @lawxen
- Assigned to Rajan Kumar@2026
- Issue was unassigned.
- Assigned to lawxen
- Status changed to Fixed
4 months ago 2:56pm 10 July 2024 Automatically closed - issue fixed for 2 weeks with no activity.
When user select css group, css file didn't get the right group number in options.
Example:
css group: theme
the group number should be set to 100 for this css.
Reference 1: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/includes/comm...
/**
* The default aggregation group for theme CSS files added to the page.
*/
const CSS_AGGREGATE_THEME = 100;
Reference 2:
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Co...
$default_options = [
'type' => 'file',
'group' => CSS_AGGREGATE_DEFAULT,
'weight' => 0,
'media' => 'all',
'preprocess' => TRUE,
];
foreach ($libraries_to_load as $library) {
[$extension, $name] = explode('/', $library, 2);
$definition = $this->libraryDiscovery->getLibraryByName($extension, $name);
if (isset($definition['css'])) {
foreach ($definition['css'] as $options) {
$options += $default_options;
// Copy the asset library license information to each file.
$options['license'] = $definition['license'];
// Files with a query string cannot be preprocessed.
if ($options['type'] === 'file' && $options['preprocess'] && str_contains($options['data'], '?')) {
$options['preprocess'] = FALSE;
}
// Always add a tiny value to the weight, to conserve the insertion
// order.
$options['weight'] += count($css) / 30000;
// CSS files are being keyed by the full path.
$css[$options['data']] = $options;
}
}
}
Cerate a new library and add a css whose group be setted to "Theme" and give a weight:10, It should be loaded after theme css with no wight.
Handle group number here like drupal core did.
https://git.drupalcode.org/project/library_manager/-/blob/2.0.x/library_...
Fixed
3.0
Code
Automatically closed - issue fixed for 2 weeks with no activity.