Skip to content

[AssetMapper] Adding note about importmap block #19252

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
Dec 13, 2023
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
8 changes: 6 additions & 2 deletions frontend/asset_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,11 @@ both ``app`` and ``checkout``:
.. code-block:: twig

{# templates/products/checkout.html.twig #}
{% block javascripts %}
{#
Override an "importmap" block in base.html.twig.
If you don't have this, add it around the {{ importmap('app') }} call.
#}
{% block importmap %}
{# do NOT call parent() #}

{{ importmap('app', 'checkout') }}
Expand All @@ -1044,7 +1048,7 @@ both ``app`` and ``checkout``:
By passing both ``app`` and ``checkout``, the ``importmap()`` function will
output the ``importmap`` and also add a ``<script type="module">`` tag that
loads the ``app.js`` file *and* the ``checkout.js`` file. It's important
to *not* call ``parent()`` in the ``javascripts`` block. Each page can only
to *not* call ``parent()`` in the ``importmap`` block. Each page can only
have *one* importmap, so ``importmap()`` must be called exactly once.

If, for some reason, you want to execute *only* ``checkout.js``
Expand Down