Skip to content

[Frontend] Add some comments about minifying assets #20346

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
Oct 25, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 10 additions & 4 deletions frontend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Supports `Stimulus/UX`_ yes yes
Supports Sass/Tailwind :ref:`yes <asset-mapper-tailwind>` yes
Supports React, Vue, Svelte? yes :ref:`[1] <ux-note-1>` yes
Supports TypeScript :ref:`yes <asset-mapper-ts>` yes
Removes comments from JavaScript no yes
Removes comments from CSS no no
Removes comments from JavaScript no :ref:`[2] <ux-note-2>` yes
Removes comments from CSS no :ref:`[2] <ux-note-2>` no
Versioned assets always optional
Can update 3rd party packages yes no :ref:`[2] <ux-note-2>`
Can update 3rd party packages yes no :ref:`[3] <ux-note-2>`
================================ ================================== ==========

.. _ux-note-1:
Expand All @@ -49,7 +49,12 @@ be executed by a browser.

.. _ux-note-2:

**[2]** If you use ``npm``, there are update checkers available (e.g. ``npm-check``).
**[2]** You can install the `SensioLabs Minify Bundle`_ to minify CSS/JS code
(and remove all comments) when compiling assets with AssetMapper.

.. _ux-note-3:

**[3]** If you use ``npm``, there are update checkers available (e.g. ``npm-check``).

.. _frontend-asset-mapper:

Expand Down Expand Up @@ -137,3 +142,4 @@ Other Front-End Articles
.. _`Turbo`: https://turbo.hotwired.dev/
.. _`Symfony UX`: https://ux.symfony.com
.. _`API Platform`: https://api-platform.com/
.. _`SensioLabs Minify Bundle`: https://github.com/sensiolabs/minify-bundle
14 changes: 11 additions & 3 deletions frontend/asset_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,16 @@ See :ref:`Optimization <optimization>` for more details.
Does the AssetMapper Component Minify Assets?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Nope! Minifying or compressing assets *is* important, but can be
done by your web server. See :ref:`Optimization <optimization>` for
more details.
Nope! In most cases, this is perfectly fine. The web asset compression performed
by web servers before sending them is usually sufficient. However, if you think
you could benefit from minifying assets (in addition to later compressing them),
you can use the `SensioLabs Minify Bundle`_.

This bundle integrates seamlessly with AssetMapper and minifies all web assets
automatically when running the ``asset-map:compile`` command (as explained in
the :ref:`serving assets in production <asset-mapper-compile-assets>` section).

See :ref:`Optimization <optimization>` for more details.

Is the AssetMapper Component Production Ready? Is it Performant?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1180,3 +1187,4 @@ command as part of your CI to be warned anytime a new vulnerability is found.
.. _Content Security Policy: https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
.. _NelmioSecurityBundle: https://symfony.com/bundles/NelmioSecurityBundle/current/index.html#nonce-for-inline-script-handling
.. _kocal/biome-js-bundle: https://github.com/Kocal/BiomeJsBundle
.. _`SensioLabs Minify Bundle`: https://github.com/sensiolabs/minify-bundle
Loading