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

https://github.com/icelam/html-variables-plugin

Plugin designed for injecting variables to HTML templates via HtmlWebpackPlugin.
https://github.com/icelam/html-variables-plugin

html-webpack-plugin npm-package webpack

Last synced: 5 months ago
JSON representation

Plugin designed for injecting variables to HTML templates via HtmlWebpackPlugin.

Awesome Lists containing this project

README

          

# HTML Variables Plugin #

This is a plugin designed for injecting variables to HTML templates via HtmlWebpackPlugin. To use this plugin, add this to your webpack right after the HtmlWebpackPlugin. This plugin accepts an object as parameter, which contains key value pairs of the variables to be injected.

## Installation ##
* `npm i html-variables-plugin`

## Usage ##
The following example declars a variable named 'foo', which it's value is 'bar'.

#### In your Webpack config: ####
```
const HtmlVariablesPlugin = require('html-variables-plugin');

module.exports = {
// ... Other settings
plugins: [
// ... HtmlWebpackPlugin and Other plugins
new HtmlVariablesPlugin({ foo: 'bar' })
]
}
```

#### In your HTML: ####
```

%foo%


```

---

## Reference ##
* [How to create plugin for HtmlWebpackPlugin](https://github.com/jantimon/html-webpack-plugin#beforeemit-hook)