How to insert raw HTML in Pug file (not include external HTML file)

后端 未结 3 892
温柔的废话
温柔的废话 2020-12-09 17:24

So what I want is to put some multiline HTML into a Pug file and can\'t find anywhere how to do this.

Example:

html
    head

    body
        

        
3条回答
  •  孤街浪徒
    2020-12-09 17:34

    This is a tested example with passing variables with raw html to the pug file:

    yourSourceFile.js

    const p1 = 'This server uses a pug template for the html output'
    res.render('yourTemplateFile', { title: 'Hey', p1 })
    

    yourTemplateFile.pug

    html
      head
        title= title
      body
        p
          | !{p1}
    

提交回复
热议问题