Class: Template
Defined in: src/template.ts:25
A compiled template bound to a Liquid Environment, ready to be rendered.
Constructors
Constructor
new Template(
env,source,nodes,globals?,meta?):Template
Defined in: src/template.ts:35
Parameters
env
source
string
nodes
globals?
meta?
Returns
Template
Properties
env
readonlyenv:Environment
Defined in: src/template.ts:36
globals
globals:
Namespace
Defined in: src/template.ts:26
name
readonlyname:string
Defined in: src/template.ts:27
nodes
readonlynodes:Block
Defined in: src/template.ts:38
overlay
overlay:
Namespace
Defined in: src/template.ts:28
path
readonlypath:string|undefined
Defined in: src/template.ts:29
source
readonlysource:string
Defined in: src/template.ts:37
upToDate
readonlyupToDate: () =>Promise<boolean>
Defined in: src/template.ts:30
Returns
Promise<boolean>
upToDateSync
readonlyupToDateSync: () =>boolean
Defined in: src/template.ts:31
Returns
boolean
Accessors
lines
Get Signature
get lines():
string[]
Defined in: src/template.ts:107
This template's source code split into lines.
Returns
string[]
Methods
analyze()
analyze(
options?):Promise<TemplateAnalysis>
Defined in: src/template.ts:126
Statically analyze this template.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<TemplateAnalysis>
analyzeSync()
analyzeSync(
options?):TemplateAnalysis
Defined in: src/template.ts:138
Statically analyze this template.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
comments()
comments(): (
CommentTag|InlineCommentTag)[]
Defined in: src/template.ts:389
Return an array of comment tag nodes found in this template.
Instances of CommentTag and InlineCommentTag have token and text
properties.
Note that this method does not try to load included or rendered templates.
Returns
(CommentTag | InlineCommentTag)[]
docs()
docs():
DocTag[]
Defined in: src/template.ts:421
Return an array of doc tag nodes found in this template.
Instances of DocTag have token and text properties.
Note that this method does not try to load included or rendered templates.
Returns
DocTag[]
filterNames()
filterNames(
options?):Promise<string[]>
Defined in: src/template.ts:350
Return an array of filter names used in this template.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<string[]>
filterNamesSync()
filterNamesSync(
options?):string[]
Defined in: src/template.ts:359
Return an array of filter names used in this template.
Parameters
options?
AnalysisOptions = ...
Returns
string[]
globalVariablePaths()
globalVariablePaths(
options?):Promise<string[]>
Defined in: src/template.ts:280
Parameters
options?
AnalysisOptions = ...
Returns
Promise<string[]>
globalVariablePathsSync()
globalVariablePathsSync(
options?):string[]
Defined in: src/template.ts:299
Return an array of variables used in this template including path segments.
Excludes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
string[]
globalVariables()
globalVariables(
options?):Promise<string[]>
Defined in: src/template.ts:259
Return an array of variables used in this template without path segments.
Excludes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<string[]>
globalVariableSegments()
globalVariableSegments(
options?):Promise<Segments[]>
Defined in: src/template.ts:318
Return an array of variables used in this template, each as a list of segments.
Excludes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<Segments[]>
globalVariableSegmentsSync()
globalVariableSegmentsSync(
options?):Segments[]
Defined in: src/template.ts:337
Return an array of variables used in this template, each as a list of segments.
Excludes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Segments[]
globalVariablesSync()
globalVariablesSync(
options?):string[]
Defined in: src/template.ts:274
Return an array of variables used in this template without path segments.
Excludes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
string[]
makeGlobals()
protectedmakeGlobals(namespace?):Namespace
Defined in: src/template.ts:49
Parameters
namespace?
Returns
render()
render(
data?):Promise<string>
Defined in: src/template.ts:71
Parameters
data?
Returns
Promise<string>
renderSync()
renderSync(
data?):string
Defined in: src/template.ts:80
Parameters
data?
Returns
string
renderWithContext()
renderWithContext(
context,buffer):Promise<void>
Defined in: src/template.ts:89
Parameters
context
buffer
Returns
Promise<void>
renderWithContextSync()
renderWithContextSync(
context,buffer):void
Defined in: src/template.ts:98
Parameters
context
buffer
Returns
void
tagNames()
tagNames(
options?):Promise<string[]>
Defined in: src/template.ts:368
Return an array of tag names used in this template.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<string[]>
tagNamesSync()
tagNamesSync(
options?):string[]
Defined in: src/template.ts:377
Return an array of filter names used in this template.
Parameters
options?
AnalysisOptions = ...
Returns
string[]
variablePaths()
variablePaths(
options?):Promise<string[]>
Defined in: src/template.ts:183
Return an array of variables used in this template including path segments.
Includes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<string[]>
variablePathsSync()
variablePathsSync(
options?):string[]
Defined in: src/template.ts:202
Return an array of variables used in this template including path segments.
Includes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
string[]
variables()
variables(
options?):Promise<string[]>
Defined in: src/template.ts:153
Return an array of variables used in this template without path segments.
Includes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<string[]>
variableSegments()
variableSegments(
options?):Promise<Segments[]>
Defined in: src/template.ts:221
Return an array of variables used in this template, each as a list of segments.
Includes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Promise<Segments[]>
variableSegmentsSync()
variableSegmentsSync(
options?):Segments[]
Defined in: src/template.ts:240
Return an array of variables used in this template, each as a list of segments.
Includes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
Segments[]
variablesSync()
variablesSync(
options?):string[]
Defined in: src/template.ts:168
Return an array of variables used in this template without path segments.
Includes variables that are local to the template, like those created
with {% assign %} and {% capture %}.
When the includePartials option is true, attempt to load and analyze
included/rendered templates too.
Parameters
options?
AnalysisOptions = ...
Returns
string[]
withGlobals()
withGlobals(
globals?):Template
Defined in: src/template.ts:62
Copy this template with new pinned global variables.
Parameters
globals?
An object who's properties will be added to the render context every time this template is rendered.
Returns
Template
A copy of this template with new render context globals.