8000 minor #15375 [WebLink] Fixed the preload links (javiereguiluz) · SirRFI/symfony-docs@eb437ab · GitHub
[go: up one dir, main page]

Skip to content

Commit eb437ab

Browse files
committed
minor symfony#15375 [WebLink] Fixed the preload links (javiereguiluz)
This PR was merged into the 4.4 branch. Discussion ---------- [WebLink] Fixed the preload links As you can see at https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload, the `<link>` elements that use preload follow this syntax: ```html <link rel="preload" href="..." as="..."> ``` That's why I think we need to change all our `rel="stylesheet"` by `rel="preload"` ... unless the `preload()` Twig function replaces the entire `<link>`, which I don't think it's the case Commits ------- 43a2d46 [WebLink] Fixed the preload links
2 parents a899dd7 + 43a2d46 commit eb437ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

web_link.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ correct prioritization and the content security policy:
6262

6363
<head>
6464
<!-- ... -->
65-
<link rel="stylesheet" href="{{ preload('/app.css', { as: 'style' }) }}">
65+
<link rel="preload" href="{{ preload('/app.css', { as: 'style' }) }}">
6666
</head>
6767

6868
If you reload the page, the perceived performance will improve because the
@@ -77,7 +77,7 @@ requested the HTML page.
7777

7878
<head>
7979
<!-- ... -->
80-
<link rel="stylesheet" href="{{ preload(asset('build/app.css')) }}">
80+
<link rel="preload" href="{{ preload(asset('build/app.css')) }}">
8181
</head>
8282

8383
Additionally, according to `the Priority Hints specification`_, you can signal
@@ -87,7 +87,7 @@ the priority of the resource to download using the ``importance`` attribute:
8787

8888
<head>
8989
<!-- ... -->
90-
<link rel="stylesheet" href="{{ preload('/app.css', { as: 'style', importance: 'low' }) }}">
90+
<link rel="preload" href="{{ preload('/app.css', { as: 'style', importance: 'low' }) }}">
9191
</head>
9292

9393
How does it work?
@@ -111,7 +111,7 @@ issuing an early separate HTTP request, use the ``nopush`` option:
111111

112112
<head>
113113
<!-- ... -->
114-
<link rel="stylesheet" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
114+
<link rel="preload" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
115115
</head>
116116

117117
Resource Hints
@@ -145,7 +145,7 @@ any link implementing the `PSR-13`_ standard. For instance, any
145145
<head>
146146
<!-- ... -->
147147
<link rel="alternate" href="{{ link('/index.jsonld', 'alternate') }}">
148-
<link rel="stylesheet" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
148+
<link rel="preload" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
149149
</head>
150150

151151
The previous snippet will result in this HTTP header being sent to the client:

0 commit comments

Comments
 (0)
0