Skip to content

Commit 64eb515

Browse files
committed
Rewords
1 parent 3865de3 commit 64eb515

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

frontend/asset_mapper.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,6 @@ to add any `npm package`_:
188188
189189
$ php bin/console importmap:require bootstrap
190190
191-
.. note::
192-
193-
If you're getting a 404 error, you can contact the package maintainer and ask them to
194-
include `"main":` and `"module":` to the package's `package.json`.
195-
196191
This adds the ``bootstrap`` package to your ``importmap.php`` file::
197192

198193
// importmap.php
@@ -212,8 +207,14 @@ This adds the ``bootstrap`` package to your ``importmap.php`` file::
212207
such as ``@popperjs/core``. The ``importmap:require`` command will add both the
213208
main package *and* its dependencies. If a package includes a main CSS file,
214209
that will also be added (see :ref:`Handling 3rd-Party CSS <asset-mapper-3rd-party-css>`).
215-
If the associated CSS file isn't added to the importmap, you can contact the package
216-
maintainer and ask them to include `"style":` to the package's `package.json`.
210+
211+
.. note::
212+
213+
If you get a 404 error, there might be some issue with the JavaScript package
214+
that prevents it from being served by the ``jsDelivr`` CDN. For example, the
215+
package might be missing properties like ``main`` or ``module`` in its
216+
`package.json configuration file`_. Try to contact the package maintainer to
217+
ask them to fix those issues.
217218

218219
Now you can import the ``bootstrap`` package like usual:
219220

@@ -449,7 +450,10 @@ To include it on the page, import it from a JavaScript file:
449450

450451
Some packages - like ``bootstrap`` - advertise that they contain a CSS
451452
file. In those cases, when you ``importmap:require bootstrap``, the
452-
CSS file is also added to ``importmap.php`` for convenience.
453+
CSS file is also added to ``importmap.php`` for convenience. If some package
454+
doesn't advertise its CSS file in the ``style`` property of the
455+
`package.json configuration file`_ try to contact the package maintainer to
456+
ask them to add that.
453457

454458
Paths Inside of CSS Files
455459
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1138,3 +1142,4 @@ command as part of your CI to be warned anytime a new vulnerability is found.
11381142
.. _sensiolabs/typescript-bundle: https://github.com/sensiolabs/AssetMapperTypeScriptBundle
11391143
.. _`dist/css/bootstrap.min.css file`: https://www.jsdelivr.com/package/npm/bootstrap?tab=files&path=dist%2Fcss#tabRouteFiles
11401144
.. _`dynamic import`: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import
1145+
.. _`package.json configuration file`: https://docs.npmjs.com/creating-a-package-json-file

0 commit comments

Comments
 (0)