Skip to content

Instantly share code, notes, and snippets.

@rayepeng
Created June 8, 2023 04:55
Show Gist options
  • Save rayepeng/91c857f108b9ff610055e42bfe6e68b1 to your computer and use it in GitHub Desktop.
Save rayepeng/91c857f108b9ff610055e42bfe6e68b1 to your computer and use it in GitHub Desktop.
// npm install ejs
const ejs = require('ejs');
// define our template
const template = `
<h1>Hello, <%= name %>!</h1>
`;
// render it
const data = { name: 'John' };
const html = ejs.render(template, data);
console.log(html);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment