mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 20:06:31 +00:00
[Doc] Provide an alternative for the deprecated spaceless filter
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
----------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user