html-webpack-simple-inject-plugin
Version:
Simplely injects a custom string into the html-webpack-plugin output
51 lines (39 loc) • 1.49 kB
Markdown
string into the html-webpack-plugin output.
[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]
[ ]: https://npmjs.org/package/html-webpack-simple-inject-plugin
[ ]: http://img.shields.io/npm/dm/html-webpack-simple-inject-plugin.svg
[ ]: http://img.shields.io/npm/v/html-webpack-simple-inject-plugin.svg
```bash
npm install --save-dev html-webpack-simple-inject-plugin
```
```js
import HtmlWebpackPlugin from "html-webpack-plugin"
import HtmlWebpackSimpleInjectPlugin from "html-webpack-simple-inject-plugin"
export default {
plugins: [
new HtmlWebpackPlugin({
templateContent: '<html><head></head><body>text</body></html>'
}),
new HtmlWebpackSimpleInjectPlugin({
content: '<div>inject</div>',
target: 'body',
position: 'start',
}),
],
}
```
```html
<html><head></head><body><div>inject</div>text</body></html>
```
|Name|Type|Default|Description|
|:--:|:--:|:-----:|:----------|
|**`content`**|`{String}`|""|The string that will be injected into the html-webpack-plugin output.|
|**`target`**|`"head"`\|`"body"`|`'head'`|The target place that you wanted to inject.|
|**`position`**|`"start"`\|`"end"`|`'end'`|If `start`, the content will be injected after the opening tag of `target`. If `end`, the content will be injected before the ending tag of `target`.|
Simplely injects a custom