Your First Template

Install Squirrelly

In this guide, we'll assume that Squirrelly is stored in a variable called Sqrl.

Create a Template

This is just a regular string.

var myTemplate = 'My favorite template engine is {{it.favorite}}.'

Define Data

var data = {
favorite: 'Squirrelly'
}

Render!

var result = Sqrl.render(myTemplate, data)
// My favorite template engine is Squirrelly.

Try Different Data

var result2 = Sqrl.render(myTemplate, {
favorite: 'Squirrelly, definitely'
})
// My favorite template engine is Squirrelly, definitely.

Full Code

var myTemplate = 'My favorite template engine is {{it.favorite}}.'
var result = Sqrl.render(myTemplate, {
favorite: 'Squirrelly, definitely'
})