0.1.1 • Published 9 years ago

silly-ejs v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

silly-ejs

A simple and small implement for EJS

NPM

Build Status Coverage Status

Install

npm

npm i silly-ejs --save

bower

bower install silly-ejs

Usage

var ejs = require('silly-ejs');
var tpl = '<div><%= name %><% if (age > 17) { %>(adult)<% } %> <%- html %></div>';
var data = {
    name: 'Hans Chan',
    age: 18,
    html: '<p>test</p>'
};
var html = ejs(tpl, data);
console.log(html);
// '<div>Hans Chan(adult) <p>test</p></div>'

Features

  • Control flow with <% %>
  • Escaped output with <%= %>
  • Unescaped raw output with <%- %>
  • Custom delimiters (e.g., use <$ $> instead of <% %>)

Custom delimiters

Custom delimiters can be applied on a per-template basis, or globally:

var ejs = require('silly-ejs');

//Custom delimiters
ejs.delimiters = '$';

var tpl = '<div><$= name $><$ if (age > 17) { %>(adult)<% } $></div>';
var data = {
    name: 'Hans Chan',
    age: 18
};
var html = ejs(tpl, data);
console.log(html);
// '<div>Hans Chan(adult)</div>'
0.1.1

9 years ago

0.1.0

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago