0.1.1 • Published 8 years ago

silly-ejs v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 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

8 years ago

0.1.0

8 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago