File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ correct prioritization and the content security policy:
59
59
60
60
<head>
61
61
<!-- ... -->
62
+ {# note that you must add two <link> tags per asset:
63
+ one to link to it and the other one to tell the browser to preload it #}
62
64
<link rel="preload" href="{{ preload('/app.css', {as: 'style'}) }}" as="style">
63
65
<link rel="stylesheet" href="/app.css">
64
66
</head>
@@ -67,6 +69,13 @@ If you reload the page, the perceived performance will improve because the
67
69
server responded with both the HTML page and the CSS file when the browser only
68
70
requested the HTML page.
69
71
72
+ .. tip ::
73
+
74
+ When using the :doc: `AssetMapper component </frontend/asset_mapper >` to link
75
+ to assets (e.g. ``importmap('app') ``), there's no need to add the ``<link rel="preload"> ``
76
+ tag. The ``importmap() `` Twig function automatically adds the ``Link `` HTTP
77
+ header for you when the WebLink component is available.
78
+
70
79
.. note ::
71
80
72
81
You can preload an asset by wrapping it with the ``preload() `` function:
You can’t perform that action at this time.
0 commit comments