Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Markup option to remove space before and after #107

darobin opened this Issue · 4 comments

5 participants


In most templating systems there is a specific syntax that makes it possible to remove white space before and/or after a template instruction. This is very useful in order to make it possible for developers to indent their code meaningfully without incurring the cost of useless white space creeping in. For instance:

{{each(i, item) stuff}}
{{/each}}: those are the results.

This will add a lot of white space that may prove problematic. Notably, the ":" right after {{/each}} is likely to end up with undesired space before it.

In several other templating languages (e.g. TT) this is handled with the addition of an optional - sign at the beginning of the template instruction. So with that {{-if test}} would remove space before it, {{/if-}} would remove space after, and {{-/each-}} would remove space on both sides.

Right now I'm preprocessing my tmpl code in order to support this, but it would be nicer to have it built it.


thats actually not common. but a good idea ;)


I think that is must have feature. Using such thing a lot in Mako and Jinja2 python template engines.

Other way is something like this:

{{each(i, item) stuff}}{{if}}blah{{else}}urgh{{/if}}{{/each}}: those are the results.

but that is less readable


I agree that this would be very valuable. My case (HTML tags that are built via a loop but that need to have no space between them) may be more common:

{{each(i, dir) result.pathComponents}}
    <a href="#${dir.query}" class="query ${result.type}">${}/</a>

I'm building a breadcrumb-style navigation control and I want there to be no space between the path components (unless I decide to tweak the CSS later).


Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.