We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Avoiding Volt to add spaces when inserting functions and variables

When I have a code, event a simple one, that prints the content of a variable to the template and/or performs a function or verifies a condition, I usually tab the HTML in the volt template to obain more readability.

These tabs are translated in the final HTML output as spaces, which translates in the browser to see undesired spacings.

Example:

      <h1>
          {% if the_title is defined %}
              {{ the_title }}
          {% endif %}
      </h1>

Translates to:

      <h1>                                        Title                               </h1>

and I see a space before and a space after the "Title".

How can I avoid this?

Thank you.

Just change in your editor tabs to be TABS, not spaces.



12.9k

Just change in your editor tabs to be TABS, not spaces.

they're actually tabs, not spaces at all.

Are you sure ? I have tabs too and i dont have any spaces.