CMS Development

simonp
Membro

what does {%- -%} mean

resolver

This is fairly straight forward question. I 've encounterd the folllowing several time I know {% %} is a statement delimiter

 

what does  the following mean

{% -     -%}

 

 

 

2 Solução aceitas
Anton
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

what does {%- -%} mean

resolver

Hi @simonp

the "minus" shortens the blank space before/after the statement. 

{%- : deletes the blank/space before the statement

-%} : deletes the blank/space after the statement

If you're in a CSS or HTML file, enable the rendered preview and see the difference.

 

This info is quite hidden. You can find it in the macro documentation.

 

Hope this helps, 

 

best, 

Anton

Anton Bujanowski Signature

Exibir solução no post original

himanshurauthan
Solução
Autoridade no assunto | Parceiro Elite
Autoridade no assunto | Parceiro Elite

what does {%- -%} mean

resolver

Hello @simonp 

the syntax {%- -%} is also used to control whitespace in the rendered output of HubSpot's templating language, HubL.

Similar to other template engines, {%- -%} tells HubL to strip any whitespace that immediately precedes or follows the enclosed expression, tag or block.

For example, consider the following HubL code:

{% for item in items %}
  <li>{{ item }}</li>
{% endfor %}

 

 

This will render a list of items, but it will also include whitespace before and after the {% for %} and {% endfor %} statements, which may result in unwanted line breaks or indentation in the final output.

To remove this extra whitespace, you can use the {%- -%} syntax like this:

{%- for item in items -%}
  <li>{{ item }}</li>
{%- endfor -%}

 This will ensure that there is no whitespace before or after the for loop statement, resulting in a cleaner rendered output.

Digital Marketing & Inbound Expert In Growth Hacking Technology

Exibir solução no post original

2 Respostas 2
himanshurauthan
Solução
Autoridade no assunto | Parceiro Elite
Autoridade no assunto | Parceiro Elite

what does {%- -%} mean

resolver

Hello @simonp 

the syntax {%- -%} is also used to control whitespace in the rendered output of HubSpot's templating language, HubL.

Similar to other template engines, {%- -%} tells HubL to strip any whitespace that immediately precedes or follows the enclosed expression, tag or block.

For example, consider the following HubL code:

{% for item in items %}
  <li>{{ item }}</li>
{% endfor %}

 

 

This will render a list of items, but it will also include whitespace before and after the {% for %} and {% endfor %} statements, which may result in unwanted line breaks or indentation in the final output.

To remove this extra whitespace, you can use the {%- -%} syntax like this:

{%- for item in items -%}
  <li>{{ item }}</li>
{%- endfor -%}

 This will ensure that there is no whitespace before or after the for loop statement, resulting in a cleaner rendered output.

Digital Marketing & Inbound Expert In Growth Hacking Technology
Anton
Solução
Especialista reconhecido(a) | Parceiro Diamante
Especialista reconhecido(a) | Parceiro Diamante

what does {%- -%} mean

resolver

Hi @simonp

the "minus" shortens the blank space before/after the statement. 

{%- : deletes the blank/space before the statement

-%} : deletes the blank/space after the statement

If you're in a CSS or HTML file, enable the rendered preview and see the difference.

 

This info is quite hidden. You can find it in the macro documentation.

 

Hope this helps, 

 

best, 

Anton

Anton Bujanowski Signature