Generates resources by making use of a template engine. The template folder structure will be kept. Folders will be interpreted as containers and files as documents. A FileIdentifierMapper will be used to generate identifiers that correspond to the relative structure.

A relative templateFolder is resolved relative to cwd, unless it's preceded by @css:, e.g. @css:foo/bar.

Hierarchy

  • TemplatedResourcesGenerator

Implements

Constructors

Properties

metadataStrategy: AuxiliaryStrategy
templateEngine: TemplateEngine<Dict<any>>
templateExtension: string
templateFolder: string

Methods

  • Generates resources with the given options. The output Map should be sorted so that containers always appear before their contents.

    Returns

    A map where the keys are the identifiers and the values the corresponding representations to store.

    Parameters

    • location: ResourceIdentifier

      Base identifier.

    • options: Dict<string>

      Options that can be used when generating resources.

    Returns AsyncIterable<Resource>

  • Generates a Resource object for the given ResourceLink. In the case of documents the corresponding template will be used. If a ResourceLink of metadata is provided the corresponding data will be added as metadata.

    Parameters

    • link: TemplateResourceLink
    • options: Dict<string>
    • Optional metaLink: TemplateResourceLink

    Returns AsyncIterable<Resource>

  • Generates TemplateResourceLinks for each entry in the given folder and combines the results so resources and their metadata are grouped together.

    Parameters

    Returns Promise<Record<string, { link: TemplateResourceLink; meta?: TemplateResourceLink }>>