reading-notes


Project maintained by will-ing Hosted on GitHub Pages — Theme by mattgraham

EJS

What is EJS?

EJS is a simple templating language that lets you generate HTML markup with plain JavaScript.

Install It’s easy to install EJS with NPM.

$ npm install ejs

Use Pass EJS a template string and some data. BOOM, you’ve got some HTML.

let ejs = require('ejs'),
    people = ['geddy', 'neil', 'alex'],
    html = ejs.render('<%= people.join(", "); %>', {people: people});

Browser support Download a browser build from the latest release, and use it in a script tag.

<script src="ejs.js"></script>
<script>
  let people = ['geddy', 'neil', 'alex'],
      html = ejs.render('<%= people.join(", "); %>', {people: people});
</script>

Main Page