Class: Goji

Goji

new Goji(options) → {Goji}

Goji is a template engine inspired by Thymeleaf. It uses regular HTML as the template "language".
Parameters:
Name Type Description
options Complier~Options Defines the options Goji will use during compilation and rendering
Source:
Returns:
Type
Goji

Methods

compile(template, options) → {Compiler~RenderFunction}

Takes a string template and parses it for includes.
Parameters:
Name Type Description
template string An HTML document or snippet
options Compiler~Options Defines the options Goji will use during compilation and rendering. Note: this will overwrite whatever options were specified in the initial constructor.
Source:
Returns:
Type
Compiler~RenderFunction

emptyCache()

Clears Goji's internal cache of templates. Does nothing if you disabled caching.
Source:

loadTemplateNamed(name) → {string|null}

Looks for a template with the given name in the templates directory (as specified by the Compiler~Options). Once found, the template is read in and returned as a string. This string can then be used with the Goji#compile method.
Parameters:
Name Type Description
name string The name of a template. E.g. if you have a template file "foo.html", you would simply provide "foo" as the name
Source:
Returns:
The template as a string or null if the template could not be found
Type
string | null