Skip to content

Commit 7318853

Browse files
committed
minor #10922 [WebLink] Add an example using Priority Hints (dunglas)
This PR was submitted for the 4.2 branch but it was squashed and merged into the 3.4 branch instead (closes #10922). Discussion ---------- [WebLink] Add an example using Priority Hints <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> See https://twitter.com/addyosmani/status/1087614725809160192 Commits ------- 4fc31c8 [WebLink] Add an example using Priority Hints
2 parents 18836b8 + 4fc31c8 commit 7318853

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

web_link.rst

Lines changed: 11 additions & 0 deletions
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)