Skip to content

Commit d999150

Browse files
committed
[AssetMapper] Update hash examples
Since 7.2, hash are shorter. This PR updates the various hashes in code examples, to illustrate more precisely what a user will see on its local install / code.
1 parent f33d93e commit d999150

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

frontend/asset_mapper.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The component has two main features:
1212
* :ref:`Mapping & Versioning Assets <mapping-assets>`: All files inside of ``assets/``
1313
are made available publicly and **versioned**. You can reference the file
1414
``assets/images/product.jpg`` in a Twig template with ``{{ asset('images/product.jpg') }}``.
15-
The final URL will include a version hash, like ``/assets/images/product-3c16d9220694c0e56d8648f25e6035e9.jpg``.
15+
The final URL will include a version hash, like ``/assets/images/product-3c16d92m.jpg``.
1616

1717
* :ref:`Importmaps <importmaps-javascript>`: A native browser feature that makes it easier
1818
to use the JavaScript ``import`` statement (e.g. ``import { Modal } from 'bootstrap'``)
@@ -70,15 +70,15 @@ The path - ``images/duck.png`` - is relative to your mapped directory (``assets/
7070
This is known as the **logical path** to your asset.
7171

7272
If you look at the HTML in your page, the URL will be something
73-
like: ``/assets/images/duck-3c16d9220694c0e56d8648f25e6035e9.png``. If you change
73+
like: ``/assets/images/duck-3c16d92m.png``. If you change
7474
the file, the version part of the URL will also change automatically.
7575

7676
.. _asset-mapper-compile-assets:
7777

7878
Serving Assets in dev vs prod
7979
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8080

81-
In the ``dev`` environment, the URL ``/assets/images/duck-3c16d9220694c0e56d8648f25e6035e9.png``
81+
In the ``dev`` environment, the URL ``/assets/images/duck-3c16d92m.png``
8282
is handled and returned by your Symfony app.
8383

8484
For the ``prod`` environment, before deploy, you should run:
@@ -283,9 +283,9 @@ outputs an `importmap`_:
283283

284284
<script type="importmap">{
285285
"imports": {
286-
"app": "/assets/app-4e986c1a2318dd050b1d47db8d856278.js",
287-
"/assets/duck.js": "/assets/duck-1b7a64b3b3d31219c262cf72521a5267.js",
288-
"bootstrap": "/assets/vendor/bootstrap/bootstrap.index-f0935445d9c6022100863214b519a1f2.js"
286+
"app": "/assets/app-4e986c1a.js",
287+
"/assets/duck.js": "/assets/duck-1b7a64b3.js",
288+
"bootstrap": "/assets/vendor/bootstrap/bootstrap.index-f093544d.js"
289289
}
290290
}</script>
291291

@@ -342,8 +342,8 @@ The ``importmap()`` function also outputs a set of "preloads":
342342

343343
.. code-block:: html
344344

345-
<link rel="modulepreload" href="/assets/app-4e986c1a2318dd050b1d47db8d856278.js">
346-
<link rel="modulepreload" href="/assets/duck-1b7a64b3b3d31219c262cf72521a5267.js">
345+
<link rel="modulepreload" href="/assets/app-4e986c1a.js">
346+
<link rel="modulepreload" href="/assets/duck-1b7a64b3.js">
347347

348348
This is a performance optimization and you can learn more about below
349349
in :ref:`Performance: Add Preloading <performance-preloading>`.
@@ -494,9 +494,9 @@ for ``duck.png``:
494494

495495
.. code-block:: css
496496
497-
/* public/assets/styles/app-3c16d9220694c0e56d8648f25e6035e9.css */
497+
/* public/assets/styles/app-3c16d92m.css */
498498
.quack {
499-
background-image: url('../images/duck-3c16d9220694c0e56d8648f25e6035e9.png');
499+
background-image: url('../images/duck-3c16d92m.png');
500500
}
501501
502502
.. _asset-mapper-tailwind:
@@ -573,7 +573,7 @@ Sometimes a JavaScript file you're importing (e.g. ``import './duck.js'``),
573573
or a CSS/image file you're referencing won't be found, and you'll see a 404
574574
error in your browser's console. You'll also notice that the 404 URL is missing
575575
the version hash in the filename (e.g. a 404 to ``/assets/duck.js`` instead of
576-
a path like ``/assets/duck.1b7a64b3b3d31219c262cf72521a5267.js``).
576+
a path like ``/assets/duck-1b7a64b3.js``).
577577

578578
This is usually because the path is wrong. If you're referencing the file
579579
directly in a Twig template:
@@ -848,7 +848,7 @@ be versioned! It will output something like:
848848

849849
.. code-block:: html+twig
850850

851-
<link rel="stylesheet" href="/assets/bundles/babdevpagerfanta/css/pagerfanta-ea64fc9c55f8394e696554f8aeb81a8e.css">
851+
<link rel="stylesheet" href="/assets/bundles/babdevpagerfanta/css/pagerfanta-ea64fc9c.css">
852852

853853
Overriding 3rd-Party Assets
854854
~~~~~~~~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)