3
votes

Can anyone help me distinguish {% %} and {%- -%}. What're the differences between those syntax. In all of my usages, I can use any of theme

1

1 Answers

5
votes

The only difference is that one strips the white space and the other doesn't.

So this {% %} will keep any white space around it.

And this {%- -%} will strip the white space.

The same applies for {{ }} and {{- -}}.

Or to keep it even more simple {{- -}} is the same as {{ }} but with the strip filter applied to it so it becomes {{ | strip }}.

You can consider it as a shorthand method for stripping the content.