Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IPluginOptions

HTML2 Plugin Options

Hierarchy

  • IPluginOptions

Index

Properties

Optional entries

entries: Record<string, Entry>

A set of options for injected records, where key is the name of the generated entry or chunk and value is a set of link or script attributes.

If not set then only the generated output of the input entries will be inserted without additional attributes.

If Entry.tag of an entry is not set then it will be determined based on other attributes and file extension.

example
{
  index: {
    type: 'module',
  },
}

Optional exclude

exclude: string[] | Set<string>

An array or set of names of entries to exclude from injection.

example
['worker']

Optional externals

externals: { after?: External[]; before?: External[] }

Arrays of additional scripts and links that will be injected to the output HTML document before or after the generated entries and chunks.

External.tag is mandatory.

example
{
  before: [{
    tag:  'link',
    href: 'https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css',
    crossorigin: 'use-credentials',
  }],
  after: [{
    tag:  'style',
    text: `
      body {
        margin:  0;
        height:  calc(100vh - 1px);
        display: flex;
      }
    `,
  }, {
    tag:  'script',
    text: 'console.log("Hello from external code!")',
  }],
}

Type declaration

Optional favicon

favicon: string

A file path of the favicon of the output HTML document. The provided file will be emitted as an asset.

Optional fileName

fileName: string

A file name of the resulting HTML document.

⚠️ Mandatory if the template option is set to an HTML.

default
path.basename(template)
example
'index.html'

Optional inject

inject: boolean

Defines whether to inject bundled files or not. If set to false then bundled files are not injected.

default
true

Optional meta

meta: Record<string, string>

A set of metadata of the output HTML document. The provided object is handled as pairs name: content.

example
{
  description: 'Generated with Rollup',
}

Optional minify

minify: false | Options

Options to pass to the html-minifier. If the options is undefined or set to false then the output HTML will not minified.

example
{
  removeComments:     true,
  collapseWhitespace: true,
  keepClosingSlash:   true,
}

Optional modules

modules: boolean
deprecated

Use entries instead.

Optional nomodule

nomodule: boolean
deprecated

Use entries instead.

Optional onlinePath

onlinePath: string

A path to append to file references injected. This is useful for putting files on a CDN after building.

example
'//www.example.com/foo'

Which will generate:

<script src="//www.example.com/foo/main.js"></script>

Optional preload

preload: string[]
deprecated

Use entries instead.

template

template: string

A path to an HTML template file or an HTML string.

example
'src/index.html'
example
'<html lang="en"><head><meta charset="utf-8"></head><body></body></html>'

Optional title

title: string

Sets the title of the output HTML document.

Generated using TypeDoc