Skip to main content

Class: abstract Loader

The base class for all template loaders.

Extended by

Constructors

new Loader()

new Loader(): Loader

Returns

Loader

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

src/loader.ts:56


getSourceSync()

abstract getSourceSync(name, renderContext?, loaderContext?): TemplateSource

A synchronous version of getSource.

Parameters

name: string

renderContext?: RenderContext

loaderContext?

Returns

TemplateSource

See

getSource

Defined in

src/loader.ts:66


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

src/loader.ts:76


loadSync()

loadSync(name, environment, context?, globals?, loaderContext?): Template

A synchronous version of load.

Parameters

name: string

environment: Environment

context?: RenderContext

globals?: ContextScope

loaderContext?

Returns

Template

See

load

Defined in

src/loader.ts:97