Navigation Menu

Skip to content

alexaschka/ejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EJS

Embedded JavaScript templates.

Installation

$ npm install ejs

Features

  • 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 %>

Example

<% if (user) { %>
  <h2><%= user.name %></h2>
<% } %>

Usage

ejs.compile(str, options);
// => Function

ejs.render(str, options);
// => str

Options

  • locals Local variables object
  • cache Compiled functions are cached, requires filename
  • filename Used by cache to key caches
  • context|scope Function execution context
  • debug Output generated function body

About

Embedded JavaScript templates for node - Express compliant

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%