When I use jsrender template engine, I want to put some comment in code, but I couldn't find tag for comments.
I know that I can use html comments, but I don't want those comments to be rendered on html at all, so <!-- -->
is out of option.
So, what I want to have is:
<script id="row-template" type="text/x-jsrender">
{{// some comment that will not be rendered}}
{{if #data[0]}}
<tr>
{{for #data tmpl="#some-template"/}}
</tr>
{{/if}}
</script>
There is a comment syntax in JsRender {{!-- this is a comment --}}
.
It works also as multi-line, so you can comment out sections of JsRender markup. It is completely eliminated from the output, so it will not find its way into the DOM (unlike HTML comments).
See http://www.jsviews.com/#commenttag.
For the complete list of built-in tags, see: http://www.jsviews.com/#jsrtags
There is simple, yet smart trick to use here.
{{if false}}
This is my comment.
It can be multi-line comment.
{{/if}}
Enjoy
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