Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/jaid/inject-body-webpack-plugin
- Owner: Jaid
- License: mit
- Created: 2020-03-05T16:26:41.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-08T04:38:23.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T18:48:10.837Z (about 1 month ago)
- Topics: add-on, addon, html, html-webpack-plugin, html-webpack-plugin-plugin, library, node, node-js, plugin, webpack, webpack-plugin
- Language: JavaScript
- Homepage: https://github.com/Jaid/inject-body-webpack-plugin
- Size: 4.53 MB
- Stars: 10
- Watchers: 2
- Forks: 6
- Open Issues: 15
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license.txt
Awesome Lists containing this project
README
# inject-body-webpack-plugin
**Webpack plugin that injects a custom string into the body of the html-webpack-plugin output.**
## Installation
```bash
npm install --save-dev inject-body-webpack-plugin@^1.3.0
``````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
Infocontent
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)