问题
I want to programatically set the content of a comment. But this doesn't work:
p Hello
// = 'Generated at ' + date
It just outputs this:
<p>Hello</p>
<!-- = 'Generated at ' + date -->
How can I output a comment with something dynamic in it? I can't see anything in the docs about this.
回答1:
Unfortunately for you in this case, Jade does not evaluate the comment's value. You can hack around this by doing:
!='<!-- Generated at ' + date + '-->'
来源:https://stackoverflow.com/questions/23829920/how-to-have-a-dynamic-value-in-an-html-comment-in-jade