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.
Blocks are used for inheritance and act as placeholders and replacements at the same time. They are documented in detail in the documentation for the extends tag. Block names must consist of alphanumeric characters, and underscores. The first char can't be a digit and dashes are not permitted.
The -%}
means to trim whitespace.
See the Whitespace Control section of the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With