如何在 Jade 的 HTML 注释中具有动态值? [英] How to have a dynamic value in an HTML comment in Jade?
本文介绍了如何在 Jade 的 HTML 注释中具有动态值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想以编程方式设置评论的内容.但这不起作用:
I want to programatically set the content of a comment. But this doesn't work:
p Hello
// = 'Generated at ' + date
它只是输出这个:
<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.
推荐答案
很遗憾,在这种情况下,Jade 不会评估评论的价值.您可以通过以下方式解决此问题:
Unfortunately for you in this case, Jade does not evaluate the comment's value. You can hack around this by doing:
!='<!-- Generated at ' + date + '-->'
这篇关于如何在 Jade 的 HTML 注释中具有动态值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文