Render

The syntax of Sqrl.Render

Syntax

Sqrl.Render(template, options)
//If template is a function, returns the result of template(options, Sqrl)
//If template is a string, it will Compile the string
//and then return compiled(options, Sqrl)

Rendering a function is usually better for performance, since Squirrelly doesn't have to re-compile the template each time it Renders.

Caching is coming soon!

Examples

Rendering a string

var myTemplate = `
My favorite template engine is {{fav}}
`
Sqrl.Render(myTemplate, {
    fav: "Squirrelly!"
})
//Returns "My favorite template engine is Squirrelly!"

Rendering a function

Last updated