Class: CachingNodeFileSystemLoader
A template loader that caches templates read from a file system.
Extends
Constructors
new CachingNodeFileSystemLoader()
new CachingNodeFileSystemLoader(
searchPath
,options
):CachingNodeFileSystemLoader
The CachingNodeFileSystemLoader
constructor.
Parameters
• searchPath: string
| string
[]
A path, or array of paths, to search for templates.
• options: CachingNodeFileSystemLoaderOptions
= {}
Loader options.
Returns
Overrides
Defined in
src/builtin/loaders/file_system_loader.ts:165
Properties
autoReload
readonly
autoReload:boolean
Defined in
src/builtin/loaders/file_system_loader.ts:152
cacheSize
readonly
cacheSize:number
Defined in
src/builtin/loaders/file_system_loader.ts:153
encoding
readonly
encoding:BufferEncoding
Defined in
src/builtin/loaders/file_system_loader.ts:154
fileExtension
readonly
fileExtension:string
Defined in
src/builtin/loaders/file_system_loader.ts:155
searchPath
readonly
searchPath:string
[]
Defined in
src/builtin/loaders/file_system_loader.ts:156
Methods
getSource()
getSource(
name
):Promise
<TemplateSource
>
Override getSource
to implement a custom loader.
Parameters
• name: string
The name or identifier of a template.
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.
Overrides
Defined in
src/builtin/loaders/file_system_loader.ts:212
getSourceSync()
getSourceSync(
name
):TemplateSource
A synchronous version of getSource
.
Parameters
• name: string
Returns
See
Overrides
Defined in
src/builtin/loaders/file_system_loader.ts:227
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?: ContextScope
Returns
Promise
<Template
>
See
getSource. Override load
to implement a caching loader.
Overrides
Defined in
src/builtin/loaders/file_system_loader.ts:248
loadSync()
loadSync(
name
,environment
,context
?,globals
?,loaderContext
?):Template
A synchronous version of load
.
Parameters
• name: string
• environment: Environment
• context?: RenderContext
• globals?: ContextScope
• loaderContext?: ContextScope
Returns
See
Overrides
Defined in
src/builtin/loaders/file_system_loader.ts:271
resolve()
protected
resolve(name
):Promise
<[string
,number
]>
Parameters
• name: string
Returns
Promise
<[string
, number
]>
Defined in
src/builtin/loaders/file_system_loader.ts:311
resolveSync()
protected
resolveSync(name
): [string
,number
]
Parameters
• name: string
Returns
[string
, number
]
Defined in
src/builtin/loaders/file_system_loader.ts:332
withFileExtension()
protected
withFileExtension(name
):string
Parameters
• name: string
Returns
string
Defined in
src/builtin/loaders/file_system_loader.ts:300
upToDate()
static
upToDate(templatePath
,mtime
):Promise
<boolean
>
Parameters
• templatePath: string
• mtime: number
Returns
Promise
<boolean
>
Defined in
src/builtin/loaders/file_system_loader.ts:189
upToDateSync()
static
upToDateSync(templatePath
,mtime
):boolean
Parameters
• templatePath: string
• mtime: number
Returns
boolean