This is an extension plugin for the webpack 5/4 plugin html-webpack-plugin - a plugin that simplifies the creation of HTML files to serve your webpack bundles.
Adds a banner to the top of generated html.
Install the plugin with npm:
$ npm install -d html-webpack-top-banner-plugin
$ yarn add -D html-webpack-top-banner-plugin
Install the plugin with npm:
$ npm install -d html-webpack-top-banner-plugin@webpack-4
$ yarn add -D html-webpack-top-banner-plugin@webpack-4
Load the plugin.
const HtmlWebpackPlugin = require('html-webpack-plugin')
const HtmlWebpackTopBannerPlugin = require('html-webpack-top-banner-plugin')
And add it to your webpack config as follows:
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackTopBannerPlugin('hello world'),
]
You will get the following results:
<!--
hello world
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Webpack App</title>
</head>
<body></body>
</html>
new HtmlWebpackTopBannerPlugin(options)
options: string | string[] |
{ banner: string | string[] }
Enter a string or array as follows:
new HtmlWebpackTopBannerPlugin('hello world')
// If you enter an array, it will be automatically converted to a string separated by '\n'.
new HtmlWebpackTopBannerPlugin(['hello world'])
Or enter a object as follows:
(New features will be added in the future)
new HtmlWebpackTopBannerPlugin({ banner: 'hello world' })
new HtmlWebpackTopBannerPlugin({ banner: ['hello world'] })
MIT