0.0.3 • Published 5 years ago

@chriscalo/ejs-extra v0.0.3

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

@chriscalo/ejs-extra

DEPRECATED. See ejs-plus

A utility for rendering EJS templates with a few enhancements.

Installation:

yarn add @chriscalo/ejs-extra
# or
npm install @chriscalo/ejs-extra

Usage:

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

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 a file rendering
  • create express view engine (docs)