@bndynet/header-injection-webpack-plugin

4.0.2 • Public • Published

header-injection-webpack-plugin (Webpack 4.x)

A webpack plugin to inject header you specified into text files(js, css, html).

Installation

npm i @bndynet/header-injection-webpack-plugin --save-dev

Usage

const HeaderInjectionWebpackPlugin = require('@bndynet/header-injection-webpack-plugin');

// webpack config
{
  plugins: [
    new HeaderInjectionWebpackPlugin()
  ]
}

Options defalut value

{
    package: './package.json',
    extensions: ['.js', '.css', '.html'],
    header: 'By default, includes name, version in your package.json and built time',  
}

Example:

const HeaderInjectionWebpackPlugin = require('@bndynet/header-injection-webpack-plugin');
const app = require('./package.json');

new HeaderInjectionWebpackPlugin({
    header: `${app.name} v${app.version} by ${app.author}`
})

Console Log:

ℹ 「hiw」: Injecting header for .html,.css,.js files ...
ℹ 「hiw」: Injecting header for main.79aa05215e152932a87d.js: /*! [hiw] header-injection-webpack-plugin / 1.0.0 / 2018-12-02T09:18:53.917Z */
ℹ 「hiw」: Injecting header for index.html: <!-- [hiw] header-injection-webpack-plugin / 1.0.0 / 2018-12-02T09:18:53.917Z -->
ℹ 「hiw」: 2 file(s) done

Package Sidebar

Install

npm i @bndynet/header-injection-webpack-plugin

Weekly Downloads

2,870

Version

4.0.2

License

MIT

Unpacked Size

5.3 kB

Total Files

3

Last publish

Collaborators

  • bndy