Skip to content

mentaljam/rollup-plugin-html2

Repository files navigation

rollup-plugin-html2

Rollup plugin to inject bundled files to an HTML template.

This plugin was inspired by the html-webpack-plugin and rollup-plugin-bundle-html.

rollup-plugin-html2 doesn't list the output directory but gets entries from the resulting bundle. Also it emits resulting HTML file as an asset so it could be accessed by other plugins.

The plugin can be used alongside the rollup-plugin-favicons. In this case rollup-plugin-favicons should be placed before rollup-plugin-html2 in the plugin list.

Install

npm i -D rollup-plugin-html2

Usage

// rollup.config.js

import html2 from 'rollup-plugin-html2'


export default {
  input: 'index.js',
  output: {
    dir: 'dist',
    format: 'es',
  },
  plugins: [
    html2({
      template: 'index.html',
    }),
  ],
}

Options

Read the documentation.

License

MIT © Petr Tsymbarovich