Skip to content

Commit 912d988

Browse files
committed
Tweaks
1 parent 6ff9491 commit 912d988

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

web_link.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff 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
6769
server responded with both the HTML page and the CSS file when the browser only
6870
requested 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:

0 commit comments

Comments
 (0)