html-webpack-top-banner-plugin

5.0.1 • Public • Published

html-webpack-top-banner-plugin

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.

Installation

webpack 5

Install the plugin with npm:

$ npm install -d html-webpack-top-banner-plugin
$ yarn add -D html-webpack-top-banner-plugin

webpack 4

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

Basic Usage

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>

Options

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'] })

License

MIT

Package Sidebar

Install

npm i html-webpack-top-banner-plugin

Weekly Downloads

10

Version

5.0.1

License

MIT

Unpacked Size

4.82 kB

Total Files

4

Last publish

Collaborators

  • ljw1412