Skip to content

vladshcherbin/rollup-plugin-generate-html

Repository files navigation

rollup-plugin-generate-html

Build Status Codecov

Generate html file for your Rollup bundle.

Installation

# yarn
yarn add rollup-plugin-generate-html -D

# npm
npm install rollup-plugin-generate-html -D

Usage

// rollup.config.js
import generateHtml from 'rollup-plugin-generate-html'

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/app.js',
    format: 'iife'
  },
  plugins: [
    generateHtml({
      filename: 'dist/public/index.html'
    })
  ]
}

Configuration

There are some useful options:

filename

Type: string

Path for generated html file.

generateHtml({
  filename: 'dist/public/index.html'
})

template

Type: string | Default: included template string

Path for template to use.

generateHtml({
  filename: 'dist/public/index.html',
  template: 'src/assets/template.html'
})

selector

Type: string | Default: body

Selector where to place scripts.

generateHtml({
  filename: 'dist/public/index.html',
  selector: 'head'
})

inline

Type: boolean | Default: false

Inline scripts in template.

generateHtml({
  filename: 'dist/public/index.html',
  inline: true
})

formatInline

Type: boolean | Default: false

Beautify inline scripts.

generateHtml({
  filename: 'dist/public/index.html',
  inline: true,
  formatInline: true
})

License

MIT

About

Generate html file for your Rollup bundle

Resources

Stars

Watchers

Forks

Packages

No packages published