Your First Template
A guide to creating your first Squirrelly template
1. Install Squirrelly
Follow the installation instructions, then require or import Squirrelly. In this example, we'll require Squirrelly as the variable Sqrl.
var Sqrl = require("squirrelly")
//Or you could: import * as Sqrl
//Or, if you're in the browser, Sqrl is already global2. Create a Template
var myTemplate = `
This is a template
My favorite template engine is: {{fav}}
My favorite kind of cake is: {{cake}}
`3. Render your Template!
var templateResult = Sqrl.Render(myTemplate, {
fav: "Squirrelly", cake: "Chocolate"
})
console.log(templateResult)
//This is a template
//My favorite template engine is: Squirrelly
//My favorite kind of cake is: ChocolateTry rendering it with other data: it still works!
Last updated