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.
- Host: GitHub
- URL: https://github.com/icelam/html-variables-plugin
- Owner: icelam
- License: mit
- Created: 2019-08-23T06:42:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-05T04:47:30.000Z (about 6 years ago)
- Last Synced: 2025-05-14T22:12:02.890Z (5 months ago)
- Topics: html-webpack-plugin, npm-package, webpack
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/html-variables-plugin
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)