Skip to main content

Type Alias: EnvironmentOptions

EnvironmentOptions: object

Liquid environment options.

Type declaration

autoEscape?

optional autoEscape: boolean

When true, render context variables will be HTML escaped before output.

Default Value

false

globals?

optional globals: ContextScope

An optional object who's properties will be added to the render context of every template rendered from this environment.

globals is not copied, so updates to it after environment construction will be visible to templates.

Default Value

An empty Object.

loader?

optional loader: Loader

A template loader. Used to load templates from a file system or database, for example.

Default Value

An empty MapLoader.

localNamespaceLimit?

optional localNamespaceLimit: number

The maximum "size" of a render context local namespace. Rather than the number of bytes in memory a local namespace occupies, "size" is a non- specific indication of how much a template uses the local namespace when it is rendered, typically using the assign and capture tags.

If localNamespaceLimit is undefined or less than 0, there is no limit. Otherwise a LocalNamespaceLimitErroris thrown when the namespace's size exceeds the limit.

Default Value

undefined

loopIterationLimit?

optional loopIterationLimit: number

The maximum number of loop iteration allowed before a LoopIterationLimitError is thrown.

If loopIterationLimit is undefined or less than 0, there is no soft limit.

Default Value

undefined

maxContextDepth?

optional maxContextDepth: number

The maximum number of times a render context can be copied or extended. This helps us guard against recursive use of the include or render tags.

Default Value

30

outputStreamLimit?

optional outputStreamLimit: number

The maximum number of bytes that can be written to a template's output stream, per render, before an OutputStreamLimitError is thrown.

If outputStreamLimit is undefined or less than 0, there is no soft limit.

Default Value

undefined

renderStreamFactory()?

optional renderStreamFactory: () => RenderStream

A factory function that will be used to create a render stream for each template rendered from the environment.

Returns

RenderStream

statementEndString?

optional statementEndString: string

The sequence of characters indicating the end of a liquid output statement.

Default Value

}}

statementStartString?

optional statementStartString: string

The sequence of characters indicating the start of a liquid output statement.

Default Value

{{

strictFilters?

optional strictFilters: boolean

When true, a NoSuchFilterError will be raised if a template attempts to use an undefined filter. When false, undefined filters are silently ignored.

Default Value

true

tagEndString?

optional tagEndString: string

The sequence of characters indicating the end of a liquid tag.

Default Value

}}

tagStartString?

optional tagStartString: string

The sequence of characters indicating the start of a liquid tag.

Default Value

{%

undefinedFactory()?

optional undefinedFactory: (name) => Undefined

A function that accepts the name of a template variable name and returns a subclass of Undefined.

Parameters

name: string

Returns

Undefined

Default Value

A LaxUndefined factory function.

Defined in

src/environment.ts:28