Backend side Javascript template engine
// in some.js
var Main = new Snejok('Main', {
greet: 'Hello World!'
template: `
{*greet*}
`
});
// in some.html:
<Main></Main>
// in some.js
var Hello = new Snejok('Hello', {
greet: 'Hello World!'
});
var Main = new Snejok('Main', {
template: `
<Hello></Hello>
`
});
// in some.html:
<Main></Main>
var newInstance = new Snejok('NewInstance', {
user: { name: 'John', age: 21 },
template: `
<ul>
{*obj user1*}
<li>{$ + 1}. {*prop*} - {*val*}</li>
{*endobj*}
</ul>
`
}
var newInstance = new Snejok('NewInstance', {
nav: ['About', 'FAQ', 'Contacts'],
template: `
<ul>
{*for nav*}
<li><a href="">{*}</a></li>
{*endfor*}
</ul>
`
}
var newInstance = new Snejok('NewInstance', {
title: 'Title',
template: `
{*if showTitle*}
<h2>{*title*}</h2>
{*endif*}
`
}
var newInstance = new Snejok('NewInstance', {
num: 4,
template: `
{: num * 5 / 5 + (20 * 20) :}
`
}
{# This is comment #}
- Ruslan Timurziyev - github.com/sawuer
This project is licensed under the MIT License - see the LICENSE.md file for details