Skip to content

FileTemplateLoader

ClassAssetInventoryAssetInventory.Editor
public class FileTemplateLoader

No description is available for this type.

public string Root { get; }

The root directory from which templates will be resolved if a caller file is not provided.

Returns

System.String — No return description is available.

public FileTemplateLoader(string root)

No description is available for this member.

Parameters

Name Type Description
root System.String

GetPath(TemplateContext, SourceSpan, string)

Section titled “GetPath(TemplateContext, SourceSpan, string)”
public string GetPath(TemplateContext context, SourceSpan callerSpan, string templateName)

Given the template context, the caller’s source span, and the template name (e.g. from an include), return the full path to the template file.

Parameters

Name Type Description
context Scriban.TemplateContext The current template context.
callerSpan Scriban.Parsing.SourceSpan The source span of the calling template (may contain a FileName).
templateName System.String The name of the template to load.

Returns

System.String — The full file system path to the template.

public string Load(TemplateContext context, SourceSpan callerSpan, string templatePath)

Synchronously loads the template content from the specified path.

Parameters

Name Type Description
context Scriban.TemplateContext The current template context.
callerSpan Scriban.Parsing.SourceSpan The source span of the calling template.
templatePath System.String The full path to the template file.

Returns

System.String — The contents of the template file as a string.

LoadAsync(TemplateContext, SourceSpan, string)

Section titled “LoadAsync(TemplateContext, SourceSpan, string)”
public ValueTask<string> LoadAsync(TemplateContext context, SourceSpan callerSpan, string templatePath)

Asynchronously loads the template content from the specified path.

Parameters

Name Type Description
context Scriban.TemplateContext The current template context.
callerSpan Scriban.Parsing.SourceSpan The source span of the calling template.
templatePath System.String The full path to the template file.

Returns

System.Threading.Tasks.ValueTask{System.String} — A ValueTask containing the template content as a string.