Created
June 8, 2023 05:00
-
-
Save rayepeng/97d0395b40576687086966897ddf7dab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install pug | |
const pug = require('pug'); | |
// definte template | |
const template = ` | |
h1 Hello, #{name}! | |
`; | |
// compilte template | |
const compiledTemplate = pug.compile(template); | |
// render template | |
const data = { name: 'John' }; | |
const html = compiledTemplate(data); | |
console.log(html); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment