To remove all intervening line breaks in a template

Use <@compress single_line=true></@compress>

 It aggressively removes indentations, empty lines and repeated spaces/tabs .

Example:

<@compress single_line=true>
<#assign users = [{"name":"Joe",        "hidden":false},
                  {"name":"James Bond", "hidden":true},
                  {"name":"Julia",      "hidden":false}]>
List of users:
<#list users as user>
  <#if !user.hidden>
  - ${user.name}
  </#if>
</#list>
That's all.
</#compress>

OUTPUT
List of users: - Joe - Julia That's all.

Leave a comment

Your email address will not be published. Required fields are marked *