Skip to content

Emiyaa/inject-webpack-plugin-head

Repository files navigation

inject-webpack-plugin-head

Installation

npm install --save-dev inject-webpack-plugin-head
yarn add --dev inject-webpack-plugin-head

Example

Input

webpack.config.babel.js

import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectHeadPlugin from "inject-webpack-plugin-head"

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

Output

index.html

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

Options

Type Default Info
content string <div id=root/> The text that will be injected into the final HTML output.
position string start If “start”, the content will be injected as close to the head opening tag as possible. If “end”, the content will be injected as close to the body ending tag as possible.

Development

Development hints for maintaining and improving inject-webpack-plugin-head

Setting up:

git clone git@github.com:Emiyaa/inject-webpack-plugin-head.git
cd inject-webpack-plugin-head
npm install

Testing in production environment:

# 打包
npm run build
# 发包 
npm publish
# 删除发错包
npm unpublish inject-webpack-plugin-head@0.0.5 --force 

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published