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)
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
var myTemplate = `
My favorite template engine is {{fav}}
`
var compiledTemplate = Sqrl.Compile(myTemplate)
Sqrl.Render(compiledTemplate, {
fav: "Squirrelly!"
})
//Returns "My favorite template engine is Squirrelly!"
Last updated