Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jaid/inject-body-webpack-plugin

Webpack plugin that injects a custom string into the body of the html-webpack-plugin output.
https://github.com/jaid/inject-body-webpack-plugin

add-on addon html html-webpack-plugin html-webpack-plugin-plugin library node node-js plugin webpack webpack-plugin

Last synced: 26 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# inject-body-webpack-plugin

License Sponsor inject-body-webpack-plugin
Build status Commits since v1.3.0 Last commit Issues
Latest version on npm Dependents Downloads

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

## Installation

inject-body-webpack-plugin on npm

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

inject-body-webpack-plugin on Yarn

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

## Example

#### Input

webpack.config.babel.js
```js
import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectBodyPlugin from "inject-body-webpack-plugin"

export default {
plugins: [
new HtmlWebpackPlugin({
templateContent: ""
}),
new InjectBodyPlugin({
content: 'Hi!'
}),
],
}
```

#### Output

index.html
```html
Hi!
```

## 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 body 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-body-webpack-plugin

Setting up:
```bash
git clone [email protected]:jaid/inject-body-webpack-plugin.git
cd inject-body-webpack-plugin
npm install
```
Testing in production environment:
```bash
npm run test
```

## License
[MIT License](https://raw.githubusercontent.com/jaid/inject-body-webpack-plugin/master/license.txt)
Copyright © 2021, Jaid \ (https://github.com/jaid)