rollup-plugin-generate-html

0.2.0 • Public • Published

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

Package Sidebar

Install

npm i rollup-plugin-generate-html

Weekly Downloads

6

Version

0.2.0

License

MIT

Unpacked Size

6.97 kB

Total Files

4

Last publish

Collaborators

  • shcherbin