template-js
Simple and Easy Javascript Templates for Node.js.
Installation
npm install template-js
Usage
// Your code var Template = var my_template = 'my.tmpl' text: "<h1>Hello World</h1>" consolemy_template
// my.tmpl This is a template It can render context items: text It can execute javascript:% for i=0;i<3;i++ %Number i : text % % It can escape strings:- text - It can include subtemplates: Enjoy!
Output:
This is a template.
It can render context items: <h1>Hello World</h1>
It can execute javascript:
Number 0: <h1>Hello World</h1>
Number 1: <h1>Hello World</h1>
Number 2: <h1>Hello World</h1>
It can escape strings:
<h1>Hello World</h1>
It can include subtemplates:
Included templates are cool!
Enjoy!