i-template
v0.0.4
Published
Beautiful nodejs template engine with full functions
Downloads
5
Readme
i-template
A nodejs template engine with full functions.
Installation
$ npm install i-template
var template = require('i-template');
template.render('<%=hi%>', {
hi: 'Hello World'
}, function(e, text) {
console.log(text); //Hello World
});
Features
- EJS grammar like
- Control flow with
<% %>
- Output with
<%= %>
- Literal output with
<%$ $%>
- Complies with the Express view system
- Master page support
- Sections support
- Includes support
- Cache of template compiled functions
- Cache of common sections
- Custom delimiters (e.g., use '' instead of '<% %>')
Quick Start
The quickest way to get started with i-template
Sample data define
var person = {
name: 'Robbin'
};
Value output with sample data
<%=name%>
Robbin
Raw output with sample data(output without parse)
<%$=user.name$%>
=user.name
Integrate with Express.JS
app.set('view engine', 'i-template');
app.engine('i-template', template.__express);
Master page
## Section
section placeholder
```html
<div class="head">
<%*logo%>
<div class="menu">
</div>
</div>
section define
<%# logo:
<div class="logo">
<a href="/">
<img src="/logo.jpg" alt="">
</a>
</div>
#%>
output
<div class="head">
<div class="logo">
<a href="/">
<img src="/logo.jpg" alt="">
</a>
</div>
<div class="menu">
</div>
</div>
## Include
## Cache