8000 GitHub - RobbinZhu/i-template: A nodejs template engine with full functions
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

RobbinZhu/i-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A nodejs template engine with full functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0