From 7eff479d4b62fb1ff5973ef867b3cc1c6b302470 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Wed, 25 Dec 2024 10:50:23 +0100 Subject: [PATCH 1/2] remove installation repetition in weblink --- web_link.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/web_link.rst b/web_link.rst index e5ad7e1159c..44e668c2112 100644 --- a/web_link.rst +++ b/web_link.rst @@ -55,13 +55,7 @@ make one request for the HTML page and another request for the linked CSS file. However, thanks to HTTP/2 your application can start sending the CSS file contents even before browsers request them. -To do that, first install the WebLink component: - -.. code-block:: terminal - - $ composer require symfony/web-link - -Now, update the template to use the ``preload()`` Twig function provided by +You can update the template to use the ``preload()`` Twig function provided by WebLink. The `"as" attribute`_ is mandatory because browsers need it to apply correct prioritization and the content security policy: From 476bb59ed934f4ae5d83e99ad1513cdfd156bc4c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 26 Dec 2024 11:36:06 +0100 Subject: [PATCH 2/2] [WebLink] Minor reword --- web_link.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web_link.rst b/web_link.rst index 44e668c2112..8602445313f 100644 --- a/web_link.rst +++ b/web_link.rst @@ -50,14 +50,14 @@ Imagine that your application includes a web page like this: -Following the traditional HTTP workflow, when this page is served browsers will -make one request for the HTML page and another request for the linked CSS file. -However, thanks to HTTP/2 your application can start sending the CSS file -contents even before browsers request them. - -You can update the template to use the ``preload()`` Twig function provided by -WebLink. The `"as" attribute`_ is mandatory because browsers need it to apply -correct prioritization and the content security policy: +In a traditional HTTP workflow, when this page is loaded, browsers make one +request for the HTML document and another for the linked CSS file. However, +with HTTP/2, your application can send the CSS file's contents to the browser +before it requests them. + +To achieve this, update your template to use the ``preload()`` Twig function +provided by WebLink. Note that the `"as" attribute`_ is required, as browsers use +it to prioritize resources correctly and comply with the content security policy: .. code-block:: html+twig