https://github.com/mentaljam/rollup-plugin-html2
Rollup plugin to inject bundled files to an HTML template
https://github.com/mentaljam/rollup-plugin-html2
html plugin rollup
Last synced: 11 months ago
JSON representation
Rollup plugin to inject bundled files to an HTML template
- Host: GitHub
- URL: https://github.com/mentaljam/rollup-plugin-html2
- Owner: mentaljam
- License: mit
- Created: 2019-05-22T22:11:26.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T03:26:13.000Z (over 2 years ago)
- Last Synced: 2025-06-13T15:55:21.836Z (12 months ago)
- Topics: html, plugin, rollup
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/rollup-plugin-html2
- Size: 485 KB
- Stars: 20
- Watchers: 2
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-html2
[Rollup](https://github.com/rollup/rollup) plugin to inject bundled files to an HTML template.
This plugin was inspired by the
[html-webpack-plugin](https://webpack.js.org/plugins/html-webpack-plugin) and
[rollup-plugin-bundle-html](https://github.com/haifeng2013/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](https://github.com/mentaljam/rollup-plugin-favicons).
In this case `rollup-plugin-favicons` should be placed before `rollup-plugin-html2`
in the plugin list.
## Install
```sh
npm i -D rollup-plugin-html2
```
## Usage
```js
// 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](https://mentaljam.github.io/rollup-plugin-html2/interfaces/ipluginoptions.html).
## License
[MIT](LICENSE) © [Petr Tsymbarovich](mailto:petr@tsymbarovich.ru)