Skip to content
Snippets Groups Projects
Commit 32dabe33 authored by ambient.impact's avatar ambient.impact
Browse files

Issue #3488459: Output weight attribute for CSS even when aggregating.

parent 7b5c4073
No related branches found
No related tags found
1 merge request!11Issue #3488459: Reduced/eliminated FOUC during Turbo loads.
......@@ -80,13 +80,10 @@ class AssetResolver implements AssetResolverInterface {
foreach (array_keys($css) as $index => $key) {
// This instructs Turbo to remove this from the DOM if it's not present in
// a subsequent request. This is added to both aggregated (optimized) and
// non-aggregated CSS assets.
// a subsequent request.
//
// This isn't as crucial when aggregation is enabled as the weight
// attribute isn't added; however, when aggregation is disabled and the
// weight attribute varies in value, Turbo will see that as a unique
// element, often causing more and more of these <link> elements to
// When the weight attribute varies in value, Turbo will see that as a
// unique element, causing more and more of these <link> elements to
// remain that point to the same stylesheet, which can cause the DOM to
// grow larger than needed as you navigate around.
//
......@@ -96,13 +93,9 @@ class AssetResolver implements AssetResolverInterface {
}
if ($optimize === true) {
return $css;
}
// If CSS is not being aggregated, output a data attribute for the front-end
// to sort the stylesheets into the correct order as Turbo currently only
// appends new stylesheets without preserving their source order.
// Output a data attribute for the front-end to sort the stylesheets into
// the correct order as Turbo currently only appends new stylesheets
// without preserving their source order.
//
// @see https://www.drupal.org/project/refreshless/issues/3399314
foreach (array_keys($css) as $index => $key) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment