Embedded JavaScript templates.
$ npm install ejs
- Complies with the Express view system
- Static caching of intermediate JavaScript
- Unbuffered code for conditionals etc
<% code %>
- Escapes html by default with
<%= code %>
- Unescaped buffering with
<%- code %>
<% if (user) { %>
<h2><%= user.name %></h2>
<% } %>
ejs.compile(str, options);
// => Function
ejs.render(str, options);
// => str
locals
Local variables objectcache
Compiled functions are cached, requiresfilename
filename
Used bycache
to key cachescontext|scope
Function execution contextdebug
Output generated function body