Skip to content

Commit 4fc31c8

Browse files
dunglasjaviereguiluz
authored andcommitted
[WebLink] Add an example using Priority Hints
1 parent 18836b8 commit 4fc31c8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web_link.rst

+11
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@ If you reload the page, the perceived performance will improve because the
6666
server responded with both the HTML page and the CSS file when the browser only
6767
requested the HTML page.
6868

69+
Additionally, according to `the Priority Hints specification`_, you can signal
70+
the priority of the resource to download using the ``importance`` attribute:
71+
72+
.. code:: twig
73+
74+
<head>
75+
{# ... #}
76+
<link rel="stylesheet" href="{{ preload('/app.css', { importance: 'low' }) }}">
77+
</head>
78+
6979
.. tip::
7080

7181
Google Chrome provides an interface to debug HTTP/2 connections. Browse
@@ -163,6 +173,7 @@ You can also add links to the HTTP response directly from controllers and servic
163173
.. _`Resource Hints`: https://www.w3.org/TR/resource-hints/
164174
.. _`Docker installer and runtime for Symfony`: https://github.com/dunglas/symfony-docker
165175
.. _`preload`: https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content
176+
.. _`the Priority Hints specification`: https://wicg.github.io/priority-hints/
166177
.. _`the Preload specification`: https://www.w3.org/TR/preload/#server-push-(http/2)
167178
.. _`Cloudflare`: https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/
168179
.. _`Fastly`: https://docs.fastly.com/guides/performance-tuning/http2-server-push

0 commit comments

Comments
 (0)