Home Manual Reference Source
public class | source

TargetsHTML

This service allows the validation of a BrowserTarget html.template file and it also takes care of generating a "default template" if the one on the target settings doesn't exist.

Constructor Summary

Public Constructor
public

constructor(events: Events, tempFiles: TempFiles)

Class constructor.

Member Summary

Public Members
public

A local reference for the events service.

public

A local reference for the tempFiles service.

Method Summary

Public Methods
public

getFilepath(target: Target, force: boolean, buildType: string): string

Given a target, this method will validate if the target has an HTML template file and return its absolute path; if the file doesn't exists, it will generate a new one, save it on the temp directory and return its path.

public

validate(target: Target): Object

Validate if a target HTML template exists or not.

Public Constructors

public constructor(events: Events, tempFiles: TempFiles) source

Class constructor.

Params:

NameTypeAttributeDescription
events Events

To reduce the settings and the template of the generated HTML files.

tempFiles TempFiles

To save a generated HTML file on the temp directory.

Public Members

public events: Events source

A local reference for the events service.

public tempFiles: TempFiles source

A local reference for the tempFiles service.

Public Methods

public getFilepath(target: Target, force: boolean, buildType: string): string source

Given a target, this method will validate if the target has an HTML template file and return its absolute path; if the file doesn't exists, it will generate a new one, save it on the temp directory and return its path.

Params:

NameTypeAttributeDescription
target Target

The target information.

force boolean
  • optional
  • default: false

Optional. If this is true, the file will be created anyways.

buildType string
  • optional
  • default: 'production'

Optional. If the HTML is for an specific type of build. This may be useful for plugins.

Return:

string

public validate(target: Target): Object source

Validate if a target HTML template exists or not.

Params:

NameTypeAttributeDescription
target Target

The target information.

Return:

Object

Return Properties:

NameTypeAttributeDescription
path string

The absolute path to the HTML template.

exists boolean

Whether or notthe HTML template exists.