picostitch
crafting (and) JavaScript

Tidbits tagged with #template (1)

#jinja

What is -%} for, in a Jinja Template? or The Magic Dash in a Jinja Template Block

What the heck does -%} mean in a Jinja template?
TL;DR: It removes whitespaces inside a block. The offical docs say it "strip[s] whitespace in templates [...] add a minus sign (-) to the start or end of a block", so {%- at the end of the block works too, but you better play with around with it to really understand it the dash is quite flexible.
Continue reading →