0.0.4 • Published 5 years ago

ejs-plus v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

ejs-plus

A utility for rendering EJS templates with enhancements.

Installation:

yarn add ejs-plus
# or
npm install ejs-plus

Usage:

const { render } = require("ejs-plus");

const html = render("./foo.ejs", {
  foo: "bar",
  list: [ 1, 2, 3 ],
});
<%
const util = require("./path/to/some/util.js");
%>
<%= foo %>
<% for (const i of list) { %>
  <%= i %>
<% } %>

Features:

  • use require() in EJS files
  • a better include() function with support for absolute, relative, and module paths
  • helpful errors messages via ejs-lint

TODO:

  • async rendering
  • separate functions for string and file rendering
  • create express view engine (docs)