Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions web_link.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ correct prioritization and the content security policy:

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

If you reload the page, the perceived performance will improve because the
Expand All @@ -74,7 +75,8 @@ requested the HTML page.

<head>
<!-- ... -->
<link rel="preload" href="{{ preload(asset('build/app.css')) }}">
<link rel="preload" href="{{ preload(asset('build/app.css')) }}" as="style">
<!-- ... -->
</head>

Additionally, according to `the Priority Hints specification`_, you can signal
Expand All @@ -84,7 +86,8 @@ the priority of the resource to download using the ``importance`` attribute:

<head>
<!-- ... -->
<link rel="preload" href="{{ preload('/app.css', { as: 'style', importance: 'low' }) }}">
<link rel="preload" href="{{ preload('/app.css', {as: 'style', importance: 'low'}) }}" as="style">
<!-- ... -->
</head>

How does it work?
Expand All @@ -108,7 +111,8 @@ issuing an early separate HTTP request, use the ``nopush`` option:

<head>
<!-- ... -->
<link rel="preload" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
<link rel="preload" href="{{ preload('/app.css', {as: 'style', nopush: true}) }}" as="style">
<!-- ... -->
</head>

Resource Hints
Expand Down Expand Up @@ -142,7 +146,8 @@ any link implementing the `PSR-13`_ standard. For instance, any
<head>
<!-- ... -->
<link rel="alternate" href="{{ link('/index.jsonld', 'alternate') }}">
<link rel="preload" href="{{ preload('/app.css', { as: 'style', nopush: true }) }}">
<link rel="preload" href="{{ preload('/app.css', {as: 'style', nopush: true}) }}" as="style">
<!-- ... -->
</head>

The previous snippet will result in this HTTP header being sent to the client:
Expand Down
Loading