How to have a dynamic value in an HTML comment in Jade?

半腔热情 提交于 2019-12-11 11:21:55

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!