Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Constructors

Properties

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

Methods

  • generateResource(link: TemplateResourceLink, options: Dict<string>, metaLink?: TemplateResourceLink): Promise<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 Promise<Resource>

  • groupLinks(folderPath: string, mapper: FileIdentifierMapper): Promise<Record<string, { link: TemplateResourceLink; meta?: TemplateResourceLink }>>
  • processFile(link: TemplateResourceLink, options: Dict<string>): Promise<Guarded<Readable>>
  • Creates a TemplateResourceLink for the given filePath. The identifier will be based on the file path stripped from the template extension, but the filePath parameter will still point to the original file.

    Parameters

    Returns Promise<TemplateResourceLink>