Reputation: 622
I know that commenting a line of code with //-
will make the line invisible to Jade compiler.
It should and does work most of times, but it totally fails within script.
tag.
For example:
script.
//- this will alert!!!
alert('test');
There still is the comment in the compiled code:
<script>
//- this will alert!!!
alert('test');
</script>
I want to keep commenting in my inline javascript code, but not letting it to the production side, how can I achieve that ?
Upvotes: 1
Views: 261
Reputation: 215009
Note the dot in script.
. The dotted block is plain text, jade syntax doesn't work there. You can have a normal block, and escape each JS line with |
:
script
//- this will alert!!!
| alert('test');
but this is rather silly. Much better would be to use external scripts and minify them for production.
Upvotes: 3