ejst
A embedded javascript template engine for nodejs.
- Auto cache template file to improving performance
- Include feature
Installation
$ npm install ejst --save
Usage
Render string template
const ejst = // render HTML stringlet str = ejstconsole
Render file template
<!--index.html--> <% if(typeof title === 'string'){ %> <%=title%> <% } %> <%=content%> <% for(var i = 0; i < buttons.length; i++){ %> <%=include('./examples/include.html', {button: buttons[i]})%> <% } %>
<!--include.html--><%=button.label%>
const ejst = // render HTML filelet data = title: 'Question' content: 'Are you sure?' buttons: label: 'Yes' type: 'green' label: 'No' type: 'gray' let str = ejstconsole
Include
<% for(var i = 0; i < buttons.length; i++){ %> <%=include('./examples/include.html', {button: buttons[i]})%> <% } %>