Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
refreshless
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
refreshless
Commits
32dabe33
Commit
32dabe33
authored
6 months ago
by
ambient.impact
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3488459
: Output weight attribute for CSS even when aggregating.
parent
7b5c4073
No related branches found
No related tags found
1 merge request
!11
Issue #3488459: Reduced/eliminated FOUC during Turbo loads.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/refreshless_turbo/src/Service/AssetResolver.php
+6
-13
6 additions, 13 deletions
modules/refreshless_turbo/src/Service/AssetResolver.php
with
6 additions
and
13 deletions
modules/refreshless_turbo/src/Service/AssetResolver.php
+
6
−
13
View file @
32dabe33
...
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment