1.3.0 • Published 3 years ago

inject-body-webpack-plugin v1.3.0

Weekly downloads
9
License
-
Repository
github
Last release
3 years ago

inject-body-webpack-plugin



Webpack plugin that injects a custom string into the body of the html-webpack-plugin output.

Installation

npm install --save-dev inject-body-webpack-plugin@^1.3.0

yarn add --dev inject-body-webpack-plugin@^1.3.0

Example

Input

webpack.config.babel.js

import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectBodyPlugin from "inject-body-webpack-plugin"

export default {
  plugins: [
    new HtmlWebpackPlugin({
      templateContent: "<html><body></body></html>"
    }),
    new InjectBodyPlugin({
      content: '<main id=root>Hi!</main>'
    }),
  ],
}

Output

index.html

<html><body><main id=root>Hi!</main></body></html>

Options

Development

Setting up:

git clone git@github.com:jaid/inject-body-webpack-plugin.git
cd inject-body-webpack-plugin
npm install

Testing in production environment:

npm run test

License

MIT License
Copyright © 2021, Jaid \jaid.jsx@gmail.com (https://github.com/jaid)