# inject-body-webpack-plugin

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

Latest version **1.3.0** (published 2021-06-19) · 0 weekly downloads

## Install

```sh
npm install inject-body-webpack-plugin
pnpm add inject-body-webpack-plugin
yarn add inject-body-webpack-plugin
bun add inject-body-webpack-plugin
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2021-06-19 |
| First published | 2020-03-05 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Jaid |
| Maintainers | jaid |
| Keywords | add-on, addon, html, html-webpack-plugin, html-webpack-plugin-plugin, library, node, node-js, plugin, webpack, webpack-plugin |

## Links

- npm: https://www.npmjs.com/package/inject-body-webpack-plugin
- Repository: https://github.com/jaid/inject-body-webpack-plugin
- Homepage: https://github.com/Jaid/inject-body-webpack-plugin
- Issues: https://github.com/jaid/inject-body-webpack-plugin/issues
- npm.io page: https://npm.io/package/inject-body-webpack-plugin

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.3.1
- [insert-string-after](https://npm.io/package/insert-string-after.md) ^1.0.0
- [insert-string-before](https://npm.io/package/insert-string-before.md) ^1.0.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2021-06-19
- 1.2.0 — 2021-06-19
- 1.1.0 — 2020-03-27
- 1.0.0 — 2020-03-05

## README

# inject-body-webpack-plugin


<a href="https://raw.githubusercontent.com/jaid/inject-body-webpack-plugin/master/license.txt"><img src="https://img.shields.io/github/license/jaid/inject-body-webpack-plugin?style=flat-square" alt="License"/></a> <a href="https://github.com/sponsors/jaid"><img src="https://img.shields.io/badge/<3-Sponsor-FF45F1?style=flat-square" alt="Sponsor inject-body-webpack-plugin"/></a>  
<a href="https://actions-badge.atrox.dev/jaid/inject-body-webpack-plugin/goto"><img src="https://img.shields.io/endpoint.svg?style=flat-square&url=https%3A%2F%2Factions-badge.atrox.dev%2Fjaid%2Finject-body-webpack-plugin%2Fbadge" alt="Build status"/></a> <a href="https://github.com/jaid/inject-body-webpack-plugin/commits"><img src="https://img.shields.io/github/commits-since/jaid/inject-body-webpack-plugin/v1.3.0?style=flat-square&logo=github" alt="Commits since v1.3.0"/></a> <a href="https://github.com/jaid/inject-body-webpack-plugin/commits"><img src="https://img.shields.io/github/last-commit/jaid/inject-body-webpack-plugin?style=flat-square&logo=github" alt="Last commit"/></a> <a href="https://github.com/jaid/inject-body-webpack-plugin/issues"><img src="https://img.shields.io/github/issues/jaid/inject-body-webpack-plugin?style=flat-square&logo=github" alt="Issues"/></a>  
<a href="https://npmjs.com/package/inject-body-webpack-plugin"><img src="https://img.shields.io/npm/v/inject-body-webpack-plugin?style=flat-square&logo=npm&label=latest%20version" alt="Latest version on npm"/></a> <a href="https://github.com/jaid/inject-body-webpack-plugin/network/dependents"><img src="https://img.shields.io/librariesio/dependents/npm/inject-body-webpack-plugin?style=flat-square&logo=npm" alt="Dependents"/></a> <a href="https://npmjs.com/package/inject-body-webpack-plugin"><img src="https://img.shields.io/npm/dm/inject-body-webpack-plugin?style=flat-square&logo=npm" alt="Downloads"/></a>

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





## Installation

<a href="https://npmjs.com/package/inject-body-webpack-plugin"><img src="https://img.shields.io/badge/npm-inject--body--webpack--plugin-C23039?style=flat-square&logo=npm" alt="inject-body-webpack-plugin on npm"/></a>

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

<a href="https://yarnpkg.com/package/inject-body-webpack-plugin"><img src="https://img.shields.io/badge/Yarn-inject--body--webpack--plugin-2F8CB7?style=flat-square&logo=yarn&logoColor=white" alt="inject-body-webpack-plugin on Yarn"/></a>

```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: "<html><body></body></html>"
    }),
    new InjectBodyPlugin({
      content: '<main id=root>Hi!</main>'
    }),
  ],
}
```

#### Output

index.html
```html
<html><body><main id=root>Hi!</main></body></html>
```







## Options



<table>
<tr>
<th></th>
<th>Type</th>
<th>Default</th>
<th>Info</th>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>&lt;div id=root/></td>
<td>The text that will be inject into the final HTML output.</td>
</tr>
<tr>
<td>position</td>
<td>string</td>
<td>start</td>
<td>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.</td>
</tr>
</table>













## Development

<details>
<summary><b>Development hints for maintaining and improving inject-body-webpack-plugin</b></summary>



Setting up:
```bash
git clone git@github.com:jaid/inject-body-webpack-plugin.git
cd inject-body-webpack-plugin
npm install
```
Testing in production environment:
```bash
npm run test
```

</details>

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

<!---
Readme generated with tldw v7.1.0
https://github.com/Jaid/tldw
-->

---
_Source: https://npm.io/package/inject-body-webpack-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
