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 {{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 {{favorite}}.'
var result = Sqrl.Render(myTemplate, {
favorite: 'Squirrelly, definitely'
})