aotr / simple-js-template

Javascript based template. No new language, no new syntax. Write everything in plain JavaScript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple-js-Template

A JavaScript based template.

Simple-js-Template contains markup with binding expressions. Templates are implemented to data objects or arrays and render into the HTML DOM or in another term A JavaScript based template engine.

Nothing new,write everything in plain JavaScript. Just make a HTML page with {%variable_name%}, which is replacable by the value (template.aotr.old.js or template.aotr.js).

The template.aotr.old.js is for amatuer users while the template.aotr.js is for advanced users working with object,loop, if else and other functionality.

Sample code snippets to know how template.aotr.js works

var templateUse = 
'have to learn this Year :' +

'<%if(this.showLearn) {%>' +
'<%for(var index in this.learn) {%>' + 
'<a href="#"><%this.learn[index]%></a>' +
'<%}%>' +
'<%} else {%>' +
'<p>none</p>' +
'<%}%>';

console.log(TemplateEngine(templateUse, {
learn: ["go", "html", "css","python","jQuery","c++"],
showLearn: true
}));

About

Javascript based template. No new language, no new syntax. Write everything in plain JavaScript.

License:BSD 2-Clause "Simplified" License


Languages

Language:JavaScript 59.3%Language:HTML 40.7%