5.3.1 • Published 2 years ago

html-webpack-inject-plugin v5.3.1

Weekly downloads
10
License
MIT
Repository
github
Last release
2 years ago

html-webpack-inject-plugin

node npm license Build Status Standard - JavaScript Style Guide

inject external tag to html

Installation

npm install --save-dev html-webpack-inject-plugin

Usage

Require the plugin in your webpack config

import HtmlWebpackInjectPlugin from 'html-webpack-inject-plugin'
// or
const HtmlWebpackInjectPlugin = require('html-webpack-inject-plugin').default

Add the plugin to your webpack config as follows

plugins: [
  new HtmlWebpackPlugin({
    filename: 'index.html'
  }),
  new HtmlWebpackPlugin({
    filename: 'other.html'
  }),
  new HtmlWebpackInjectPlugin({
    externals: [
      {
        tagName: 'script',
        attributes: {
          src: 'common-script.js',
          type: 'text/javascript'
        }
      },
      {
        tagName: 'script',
        attributes: {
          src: 'only-inject-to-other-script.js',
          type: 'text/javascript'
        },
        include: ['other.html']
      }
    ],
    prepend: true // default is false
  })
]

Options

  • externals: <HtmlAssetItem>[]: external HTMLTagObject which you want to add
  • prepend: insert before parent first child
5.3.1

2 years ago

5.3.0

2 years ago

5.2.3

2 years ago

5.2.2

2 years ago

5.2.1

2 years ago

5.2.0

2 years ago

5.1.1

3 years ago

5.1.0

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.1

4 years ago

4.0.2

4 years ago

4.0.0

4 years ago

3.1.0

5 years ago

3.0.4

5 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago