Class: abstract
Loader
The base class for all template loaders.
Extended by
ChoiceLoader
NodeFileSystemLoader
CachingNodeFileSystemLoader
MapLoader
ObjectLoader
FetchLoader
XMLHttpRequestLoader
Constructors
new Loader()
new Loader():
Loader
Returns
Methods
getSource()
abstract
getSource(name
,renderContext
?,loaderContext
?):Promise
<TemplateSource
>
Override getSource
to implement a custom loader.
Parameters
• name: string
The name or identifier of a template.
• renderContext?: RenderContext
The active render context, if there is one.
• loaderContext?
Additional context. By convention, tags that load
templates should add a tag
property to the loader context containing
the tag's name.
Returns
Promise
<TemplateSource
>
The source, with any meta data, for the template identified by the given name
Throws
TemplateNotFoundError Thrown if the template can not be found.
Defined in
getSourceSync()
abstract
getSourceSync(name
,renderContext
?,loaderContext
?):TemplateSource
A synchronous version of getSource
.
Parameters
• name: string
• renderContext?: RenderContext
• loaderContext?
Returns
See
Defined in
load()
load(
name
,environment
,context
?,globals
?,loaderContext
?):Promise
<Template
>
Used internally by Environment.getTemplate()
. Delegates to getSource
.
Parameters
• name: string
• environment: Environment
• context?: RenderContext
• globals?: ContextScope
• loaderContext?
Returns
Promise
<Template
>
See
getSource. Override load
to implement a caching loader.
Defined in
loadSync()
loadSync(
name
,environment
,context
?,globals
?,loaderContext
?):Template
A synchronous version of load
.
Parameters
• name: string
• environment: Environment
• context?: RenderContext
• globals?: ContextScope
• loaderContext?