KargWare
KargWare

Reputation: 2183

Jeykyll, what is the difference between {%- do-someting -%} and {% do-someting %}?

In the Jeykll in documentation to Liquid I found the notation {% … %} but in some plugins or example code snippets I saw also {%- … -%} (with a dash after and before percentage symbol). What is the right usage?

Or is it even dependent from the command / option / function which I am using inside the block?

Upvotes: 3

Views: 270

Answers (1)

Mattie
Mattie

Reputation: 3028

The dashes give you the ability to control the whitespace around your tags. This often isn’t necessary for HTML generation, but can come in handy for certain uses in pre-formatted text. Or, if you are just picky about what your final HTML looks like ;)

Check out the docs here: https://shopify.github.io/liquid/basics/whitespace/

Upvotes: 5

Related Questions