Skip to content

chriscalo/ejs-plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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) { %>
  <%= util.doThing(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)

About

Use require() in EJS templates.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published