markvgti
markvgti

Reputation: 4619

Printing expression values inside comments in Jade template

Need to print the value of a parameter inside a Jade template comment. The value is passed-in correctly; the following works as expected:

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")

However, all attempts to print out the value of the type variable inside a comment have failed. I've tried the following forms:

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

and many others, but nothing works (everything gets printed exactly as I typed it in). I'd like the output:

<!-- type = challenge -->

or

<!-- type = survey -->

All help appreciated!

Upvotes: 0

Views: 90

Answers (1)

Bartosz Czerwonka
Bartosz Czerwonka

Reputation: 1651

Maybe this way will be good for you:

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

Upvotes: 3

Related Questions