I'm learning ember.js and would like to sometimes deactivate some chunks of code. I know {{! }}
works for single-line commenting inside <script type="text/x-handlebars">
, but I can't make it work for multi-line commenting. Maybe because I have conditional statements inside.
<script type="text/x-handlebars" id="stuff"> {{! {{#if length}} foobar {{/if}} }} </script>
but then I got this error:
Uncaught Error: Parse error on line xx: ...ngth}} foobar {{/if}}}} {{ o ---------------------^ Expecting 'EOF', got 'OPEN_ENDBLOCK'
I also tried using <!-- ... -->
, while the section is not shown, but I also get this error:
Uncaught Error: Cannot perform operations on a Metamorph that is not in the DOM
this error doesn't show up if I just delete that chunk of code.
Multiline (Block) Comments Javascript multiline comments, also known as block comments, start with a forward slash followed by an asterisk (/*) and end with an asterisk followed by a forward slash (*/). They do not require a comment delimiter character on every line and may contain newlines.
Just add an exclamation mark after the opening brackets. Note that the difference between {{! and {{! -- forms is that only the latter allows embedded handlebars tags. As that will be easy to forget, especially in a long comment that is later revised, I would suggest to always use the longer comment form.
To comment out multiple lines in Python, you can prepend each line with a hash ( # ).
Add
{{!-- This is a multiline comment --}}
for multiline comments
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