Implementation of the ViewEngine class that renders Pug/Jade templates.

Hierarchy

Constructors

Properties

compileCache: {
    [key: string]: ((locals?: pug.LocalsObject) => string);
} = {}

A cache of compiled templates.

Type declaration

  • [key: string]: ((locals?: pug.LocalsObject) => string)
      • (locals?: pug.LocalsObject): string
      • Parameters

        • Optional locals: pug.LocalsObject

        Returns string

config: Config
debug: boolean
globals: {
    [key: string]: ((req: Maybe<Request>) => any);
} = {}

Type declaration

namespaces: {
    [key: string]: UniversalPath;
} = {}

Type declaration

routing: Routing

Accessors

Methods

  • Get the method with the given name from this class, bound to this class.

    Returns

    function

    Parameters

    • methodName: string

    Returns ((...args: any[]) => any)

      • (...args: any[]): any
      • Get the method with the given name from this class, bound to this class.

        Returns

        function

        Parameters

        • Rest ...args: any[]

        Returns any

  • Protected

    Get the global variables that should be passed to every view rendered.

    Returns {
        [key: string]: any;
    }

    • [key: string]: any
  • Protected

    Get the object of options passed to Pug's compile methods.

    Parameters

    • Optional templateName: string

    Returns Options

  • Call the make() method on the global container.

    Type Parameters

    • T

    Parameters

    • target: any
    • Rest ...parameters: any[]

    Returns T

  • Given the canonical name of a template file, render the file using the provided variables.

    Parameters

    • templateName: string
    • locals: {
          [p: string]: any;
      }
      • [p: string]: any

    Returns string | Promise<string>

  • Given a template string and a set of variables for the view, render the string to HTML and return it.

    Parameters

    • templateString: string
    • locals: {
          [p: string]: any;
      }
      • [p: string]: any

    Returns string | Promise<string>