grenierdev / sinaps-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sinaps Template

Sinaps Template is a template engin similar to Jinja2 and Twig using PEGjs modified Javascript ES5.1 parser. So every expression is JS compatible and no surprise is awaiting you.

Build Status

Install

npm install --save sinaps-template

or

<script src="sinaps-template.min.js"></script>

Getting started

Create an Environment instance

An environment instance will be your entry point for all template compilation and rendering.

var env = new Environment();

Compile your first string

var template = env.compileString('Hello {{ world }}');

Render to a string

console.log(template({foo: 'World'}).output); // "Hello World"
console.log(template({foo: 'Peter'}).output); // "Hello Peter"

About


Languages

Language:JavaScript 100.0%Language:HTML 0.0%