Class HTMLGenerator

This is a utility service that generates an HTML file with custom information when the application is started.

Constructors

Properties

_config: SimpleConfig

The application configuration service, to get the settings specified by the configKeys option.

_fileDeferred?: DeferredPromise<void>

A deferred promise to return when another service asks if the file has been generated. Once this sevice finishes generating the file, the promise will be resolved for all implementations that hold a reference to this deferred.

_fileReady: boolean = false

Whether or not the file was already generated.

_frontendFs: FrontendFs

The service that interacts with the filesystem.

_logger: SimpleLogger

The service that logs messages on the terminal, in case the silent option is false.

The service customization options.

A service that can provide values to be replaced in the template.

Accessors

Methods

  • Helper method to get the values that will be replaced in the template. If a "values service" was specified in the constructor, it will get the values from there, otherwise, it will use the configKeys option to get the values from the application configuration.

    Returns Promise<Record<string, unknown>>

  • Processes the HTML template by replacing the placeholders with the actual values.

    Parameters

    • template: string

      The template for the HTML file.

    • values: Record<string, unknown>

      The values dictionary that should be replaced in the template.

    Returns string