https://github.com/haoliangyu/html-webpack-processing-plugin
html-webpack-plugin extension for html pre-processing and post-processing
https://github.com/haoliangyu/html-webpack-processing-plugin
event html-webpack-plugin webpack webpack-plugin
Last synced: 3 months ago
JSON representation
html-webpack-plugin extension for html pre-processing and post-processing
- Host: GitHub
- URL: https://github.com/haoliangyu/html-webpack-processing-plugin
- Owner: haoliangyu
- License: mit
- Created: 2016-10-30T17:09:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T11:12:20.000Z (over 2 years ago)
- Last Synced: 2025-03-24T03:11:31.393Z (3 months ago)
- Topics: event, html-webpack-plugin, webpack, webpack-plugin
- Language: JavaScript
- Size: 1.24 MB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# html-webpack-processing-plugin
[](https://www.npmjs.com/package/html-webpack-processing-plugin) [](https://github.com/haoliangyu/html-webpack-processing-plugin/blob/master/LICENSE) [](https://www.travis-ci.org/haoliangyu/html-webpack-processing-plugin)
HTML pre-processing and post-processing for [html-webpack-plugin](https://github.com/ampedandwired/html-webpack-plugin). It supports webpack v4.
## Installation
```bash
npm install html-webpack-processing-plugin
```## Usage
- add pre-processor
```javascript
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HtmlWebpackProcessingPlugin = require("html-webpack-processing-plugin");const webpackConfig = {
";
entry: "index.js",
output: {
path: "dist",
filename: "index_bundle.js",
},
plugins: [
new HtmlWebpackPlugin({
preProcessing: (originalHTML) => {
let newHTML = originalHTML + "
return newHTML;
},
}),
new HtmlWebpackProcessingPlugin(),
],
};
```- add post-processor
```javascript
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackProcessingPlugin = require('html-webpack-processing-plugin';)const webpackConfig = {
';
entry: 'index.js',
output: {
path: 'dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
postProcessing: originalHTML => {
let newHTML = originalHTML + '
return newHTML;
}
}),
new HtmlWebpackProcessingPlugin()
]
};
```## License
This project is licensed under MIT.