What does the hyphen mean for a block in Twig like in {% block body -%}?

Twig

Twig Problem Overview


When generating a CRUD in a Symfony2 application with Doctrine commands, generated Twig template content is defined within a Twig block this way:

{% block body -%}

{% endblock %}

What does the hyphen in -%} mean? It works fine without the hyphen and I could not find anything similar in the Twig documentation.

Twig Solutions


Solution 1 - Twig

The -%} means to trim whitespace.

See the Whitespace Control section of the docs.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichaël PerrinView Question on Stackoverflow
Solution 1 - TwigDave NewtonView Answer on Stackoverflow