Skip to content

Commit bb3f806

Browse files
committed
Reword
1 parent a5d5b4e commit bb3f806

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

reference/configuration/framework.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,8 @@ enabled
20562056

20572057
Whether to enable or not SSI support in your application.
20582058

2059+
.. _reference-assets:
2060+
20592061
assets
20602062
~~~~~~
20612063

templates.rst

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -312,24 +312,18 @@ You can now use the ``asset()`` function:
312312
{# the JS file lives at "public/bundles/acme/js/loader.js" #}
313313
<script src="{{ asset('bundles/acme/js/loader.js') }}"></script>
314314

315-
Using the ``asset()`` function is recommended for two reasons:
316-
317-
* It automatically takes care of versioning your assets with
318-
:doc:`Symfony's AssetMapper </frontend>`
319-
320-
* If your application lives at the root of your host (e.g. ``https://example.com``),
321-
then the rendered path should be ``/images/logo.png``. But if your application
322-
lives in a subdirectory (e.g. ``https://example.com/my_app``), each asset path
323-
should render with the subdirectory (e.g. ``/my_app/images/logo.png``). The
324-
``asset()`` function takes care of this by determining how your application is
325-
being used and generating the correct paths accordingly.
326-
327-
.. tip::
328-
329-
The ``asset()`` function supports various cache busting techniques via the
330-
:ref:`version <reference-framework-assets-version>`,
331-
:ref:`version_format <reference-assets-version-format>`, and
332-
:ref:`json_manifest_path <reference-assets-json-manifest-path>` configuration options.
315+
Using the ``asset()`` function is recommended for these reasons:
316+
317+
* **Asset versioning**: ``asset()`` appends a version hash to asset URLs for
318+
cache busting. This works both via :doc:`AssetMapper </frontend>` and the
319+
:doc:`Asset component </components/asset>` (see also the
320+
:ref:`assets configuration options <reference-assets>`, such as ``version``
321+
and ``version_format``).
322+
323+
* **Application portability**: whether your app is hosted at the root
324+
(e.g. ``https://example.com``) or in a subdirectory (e.g. ``https://example.com/my_app``),
325+
``asset()`` generates the correct path (e.g. ``/images/logo.png`` vs ``/my_app/images/logo.png``)
326+
automatically based on your app's base URL.
333327

334328
If you need absolute URLs for assets, use the ``absolute_url()`` Twig function
335329
as follows:

0 commit comments

Comments
 (0)