在 Jade 模板的注释中打印表达式值

Printing expression values inside comments in Jade template

需要在 Jade 模板注释中打印参数值。值传入正确;以下按预期工作:

if type !== "surveyFree"
    ul.pollOptions
        for answer, idx in answers
            li
                +printAnswer(answer, idx)
else
    textarea(cols="50", rows="4", placeholder="Type in your answer")

然而,所有在注释中打印出 type 变量值的尝试都失败了。我试过以下形式:

// "type = " + type
// #{"type = " + type}
// span= #{"type = " + type}
// span= type = #{type}

和许多其他人,但没有任何效果(一切都按照我输入的方式打印)。我想要输出:

<!-- type = challenge -->

<!-- type = survey -->

感谢所有帮助!

也许这种方式对你有好处:

!='<!-- COMMENT VARAIBLE: ' + variable + '-->'