https://github.com/taylorpzreal/interpolate-webpack-plugin
Interpolate custom variables or glob path into 'index.html'
https://github.com/taylorpzreal/interpolate-webpack-plugin
interpolate-webpack-plugin webpack webpack-plugin
Last synced: 4 months ago
JSON representation
Interpolate custom variables or glob path into 'index.html'
- Host: GitHub
- URL: https://github.com/taylorpzreal/interpolate-webpack-plugin
- Owner: TaylorPzreal
- License: mit
- Created: 2017-12-29T05:51:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T07:58:03.000Z (over 2 years ago)
- Last Synced: 2025-01-21T23:19:18.007Z (6 months ago)
- Topics: interpolate-webpack-plugin, webpack, webpack-plugin
- Language: JavaScript
- Homepage:
- Size: 1.96 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# interpolate-webpack-plugin
> Support webpack@^4, you should use html-webpack-plugin@next(now is html-webpack-plugin@^4.0.8).

[](https://circleci.com/gh/TaylorPzreal/interpolate-webpack-plugin)[Extend react-dev-utils/InterpolateHtmlPlugin](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-dev-utils/InterpolateHtmlPlugin.js)
It works in tandem with [HtmlWebpackPlugin@next](https://github.com/ampedandwired/html-webpack-plugin#events).
I use it for dynamic inject library that DllPlugin generated and in React product replace '%PUBLIC_URL%'.
## Usage
### 1. Installation
```bash
yarn add -D interpolate-webpack-plugin
```### 2. index.html
```html
```
### 3. Config webpack.config.js
```js
const InterpolateWebpackPlugin = require('interpolate-webpack-plugin');plugins: [
// options could be an object or array.
new InterpolateWebpackPlugin([{
key: 'INJECT_DLL',
value: 'ABSOLUTELY',
type: 'STRING'
// type can only be 'STRING', 'PATH' or 'OUTPUTPATH', default is 'STRING'.
// When type is 'PATH', the 'value' you could input a glob string,like:
// process.cwd() + 'dll/*.js',
// but it could only resolve matched first file name.
}])
]
```If you input wrong options or wrong type, will got a tip:
#### Options wrong

#### Type wrong

## License
MIT License Copyright (c) 2017 TaylorPzreal