Skip to content

Commit 66ae926

Browse files
committed
feature #51829 [AssetMapper] Automatically preload CSS files if WebLink available (weaverryan)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [AssetMapper] Automatically preload CSS files if WebLink available | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | None | License | MIT Hi! In AssetMapper 6.4, we now know which CSS files will be rendered on the page. So, I think there is now downside to adding a `Link` header in the response to load those CSS files, but someone tell me if I'm missing something. The only possible situation I can think of where this isn't wanted is if you decided to handle your critical CSS manually (i.e. with normal `<link rel="stylesheet">` tags in `base.html.twig`) and load a few less-critical CSS files through the ImportMap system. In that case, we would preload only these "less-critical" CSS, which could take a slight priority over the others. But I think the benefit this would give to most apps outweighs this. We could always add an opt-out later. Cheers! Commits ------- 2995c16c47 [AssetMapper] Automatically preload CSS files if WebLink available
2 parents 20f0826 + fb0b869 commit 66ae926

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Resources/config/asset_mapper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
param('kernel.charset'),
175175
abstract_arg('polyfill URL'),
176176
abstract_arg('script HTML attributes'),
177+
service('request_stack'),
177178
])
178179

179180
->set('asset_mapper.importmap.auditor', ImportMapAuditor::class)

0 commit comments

Comments
 (0)