Skip to content

Add a note for preload asset #12179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2019
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
11 changes: 11 additions & 0 deletions web_link.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down