zibri
    Preparing search index...

    Class HandlebarUtilitiesAbstract

    Utilities for handling handlebar templates.

    Index

    Constructors

    Methods

    • Initializes the handlebar utilities.

      Parameters

      • H: typeof Handlebars

        The external handlebar object. Is needed so helpers can be registered both inside and outside of Zibri.

      • componentsDir: string

        The directory where components reside.

      Returns Promise<void>

    • Parses the given handlebars string into an AST.

      Parameters

      • input: string

        The handlebars template in form of a string.

      • Optionaloptions: ParseOptions

        Additional options for parsing the template.

      Returns AstProgram

      The abstract syntax tree of the template.

    • Compiles the given handlebars string.

      Type Parameters

      • T

      Parameters

      • input: string

        The handlebars template in form of a string.

      • Optionaloptions: CompileOptions

        Additional options for compilation.

      Returns HandlebarsTemplateDelegate<T>

      The compiled template function.

    • Renders the template at the given path with the given data.

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      • path: `${FsPath}.hbs`

        The path of the handlebars template file.

      • data: T

        The data to fill into the template.

      Returns Promise<string>

      The rendered html string.

    • Renders the given handlebars template string as html, using the provided data as variables.

      Type Parameters

      • T extends Record<string, unknown>

      Parameters

      • templateString: string

        The handlebars template string.

      • data: T

        The data to use inside the template.

      Returns string

      The rendered html content.