Generate html file for your Rollup bundle.
# yarn
yarn add rollup-plugin-generate-html -D
# npm
npm install rollup-plugin-generate-html -D
// 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'
})
]
}
There are some useful options:
Type: string
Path for generated html file.
generateHtml({
filename: 'dist/public/index.html'
})
Type: string
| Default: included template string
Path for template to use.
generateHtml({
filename: 'dist/public/index.html',
template: 'src/assets/template.html'
})
Type: string
| Default: body
Selector where to place scripts.
generateHtml({
filename: 'dist/public/index.html',
selector: 'head'
})
Type: boolean
| Default: false
Inline scripts in template.
generateHtml({
filename: 'dist/public/index.html',
inline: true
})
Type: boolean
| Default: false
Beautify inline scripts.
generateHtml({
filename: 'dist/public/index.html',
inline: true,
formatInline: true
})
MIT