Add a note for preload asset

This commit is contained in:
Antoine Lamirault
2019-08-15 13:43:23 +02:00
parent 6bea43f06a
commit d9b88d7fc8

View File

@@ -66,6 +66,17 @@ If you reload the page, the perceived performance will improve because the
server responded with both the HTML page and the CSS file when the browser only
requested the HTML page.
.. note::
You can preload an asset by wrapping it with the ``preload()`` function
.. code-block:: html+twig
<head>
{# ... #}
<link rel="stylesheet" href="{{ preload(asset('build/app.css')) }}">
</head>
Additionally, according to `the Priority Hints specification`_, you can signal
the priority of the resource to download using the ``importance`` attribute: