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