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

https://github.com/superraytin/html-webpack-simple-inject-plugin

Injects a custom string into the html-webpack-plugin output.
https://github.com/superraytin/html-webpack-simple-inject-plugin

Last synced: about 1 year ago
JSON representation

Injects a custom string into the html-webpack-plugin output.

Awesome Lists containing this project

README

          

# html-webpack-simple-inject-plugin
Simplely injects a custom string into the html-webpack-plugin output.

[![NPM version][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]

[npm-url]: https://npmjs.org/package/html-webpack-simple-inject-plugin
[downloads-image]: http://img.shields.io/npm/dm/html-webpack-simple-inject-plugin.svg
[npm-image]: http://img.shields.io/npm/v/html-webpack-simple-inject-plugin.svg

## Installation

```bash
npm install --save-dev html-webpack-simple-inject-plugin
```

## Example

#### input

```js
import HtmlWebpackPlugin from "html-webpack-plugin"
import HtmlWebpackSimpleInjectPlugin from "html-webpack-simple-inject-plugin"

export default {
plugins: [
new HtmlWebpackPlugin({
templateContent: 'text'
}),
new HtmlWebpackSimpleInjectPlugin({
content: '

inject
',
target: 'body',
position: 'start',
}),
],
}
```

#### output

```html

inject
text
```

## Options

|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`.|