Class: CachingNodeFileSystemLoader
Defined in: src/loaders/file_system_loader.ts:213
A template loader that caches templates read from a file system.
Extends
Constructors
Constructor
new CachingNodeFileSystemLoader(
searchPath,options?):CachingNodeFileSystemLoader
Defined in: src/loaders/file_system_loader.ts:221
Parameters
searchPath
string | string[]
A path or array of paths to search for templates.
options?
CachingNodeFileSystemLoaderOptions
Returns
CachingNodeFileSystemLoader
Overrides
NodeFileSystemLoader.constructor
Properties
autoReload
readonlyautoReload:boolean
Defined in: src/loaders/file_system_loader.ts:214
cacheSize
readonlycacheSize:number
Defined in: src/loaders/file_system_loader.ts:215
encoding
readonlyencoding:BufferEncoding
Defined in: src/loaders/file_system_loader.ts:56
Inherited from
fileExtension
readonlyfileExtension:string
Defined in: src/loaders/file_system_loader.ts:57
Inherited from
NodeFileSystemLoader.fileExtension
searchPath
readonlysearchPath:string[]
Defined in: src/loaders/file_system_loader.ts:58
Inherited from
NodeFileSystemLoader.searchPath
Methods
getSource()
getSource(
env,name,context?,options?):Promise<TemplateSource>
Defined in: src/loaders/file_system_loader.ts:93
Load template source text and meta data.
Parameters
env
The active template environment.
name
string
A name or identifier for the target template.
context?
The current render context, if one is available.
options?
Record<string, unknown>
Arbitrary options that can be used to narrow the template search space.
Returns
Promise<TemplateSource>
Inherited from
NodeFileSystemLoader.getSource
getSourceSync()
getSourceSync(
env,name,context?,options?):TemplateSource
Defined in: src/loaders/file_system_loader.ts:116
A synchronous version of getSource.
Parameters
env
name
string
context?
options?
Record<string, unknown>
Returns
See
Inherited from
NodeFileSystemLoader.getSourceSync
load()
load(
env,name,globals?,context?,options?):Promise<Template>
Defined in: src/loaders/file_system_loader.ts:236
Used internally by Environment.parse(). Delegates to getSource.
Parameters
env
name
string
globals?
context?
options?
Record<string, unknown>
Returns
Promise<Template>
See
getSource. Override load to implement a caching loader.
Overrides
loadSync()
loadSync(
env,name,globals?,context?,options?):Template
Defined in: src/loaders/file_system_loader.ts:261
A synchronous version of load.
Parameters
env
name
string
globals?
context?
options?
Record<string, unknown>
Returns
See
Overrides
resolve()
protectedresolve(name):Promise<[string,number]>
Defined in: src/loaders/file_system_loader.ts:164
Find the path to the template file with the given name.
Parameters
name
string
A template file name relative to one of the paths in the current search path.
Returns
Promise<[string, number]>
The template file name joined with the first path in the configured search path that is a file.
Throws
TemplateNotFoundError If a file with the given name can not be found.
Inherited from
resolveSync()
protectedresolveSync(name): [string,number]
Defined in: src/loaders/file_system_loader.ts:183
A synchronous version of resolve.
Parameters
name
string
Returns
[string, number]
Inherited from
NodeFileSystemLoader.resolveSync
withFileExtension()
protectedwithFileExtension(name):string
Defined in: src/loaders/file_system_loader.ts:149
Append the default file extension if the given template name does not have one.
Parameters
name
string
A template file name relative to one of the paths in the current search path.
Returns
string
The argument name with the default file extension, if it did not already have one.
Inherited from
NodeFileSystemLoader.withFileExtension
upToDate()
staticupToDate(templatePath,mtime):Promise<boolean>
Defined in: src/loaders/file_system_loader.ts:76
Parameters
templatePath
string
mtime
number
Returns
Promise<boolean>
Inherited from
upToDateSync()
staticupToDateSync(templatePath,mtime):boolean
Defined in: src/loaders/file_system_loader.ts:85
Parameters
templatePath
string
mtime
number
Returns
boolean