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:
5959
6060 <head>
6161 <!-- ... -->
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 #}
6264 <link rel="preload" href="{{ preload('/app.css', {as: 'style'}) }}" as="style">
6365 <link rel="stylesheet" href="/app.css">
6466 </head>
@@ -67,6 +69,13 @@ If you reload the page, the perceived performance will improve because the
6769server responded with both the HTML page and the CSS file when the browser only
6870requested the HTML page.
6971
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+
7079.. note ::
7180
7281 You can preload an asset by wrapping it with the ``preload() `` function:
You can’t perform that action at this time.
0 commit comments