[Doc] Provide an alternative for the deprecated spaceless filter

This commit is contained in:
Javier Eguiluz
2024-09-12 11:42:41 +02:00
parent 6fa404ffdf
commit b5d19ee4be
2 changed files with 2 additions and 16 deletions
+2 -1
View File
@@ -3,7 +3,8 @@
.. warning::
The ``spaceless`` filter is deprecated as of Twig 3.12.
The ``spaceless`` filter is deprecated as of Twig 3.12. Instead, use the
:ref:`whitespace control features <templates-whitespace-control>`.
Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not
whitespace within HTML tags or whitespace in plain text:
-15
View File
@@ -934,21 +934,6 @@ the modifiers on one side of a tag or on both sides:
{{~ value }} </li>
{# outputs '<li>\nno spaces </li>' #}
.. tip::
In addition to the whitespace modifiers, Twig also has a ``spaceless`` filter
that removes whitespace **between HTML tags**:
.. code-block:: html+twig
{% apply spaceless %}
<div>
<strong>foo bar</strong>
</div>
{% endapply %}
{# output will be <div><strong>foo bar</strong></div> #}
Extensions
----------