Miss any of our Open RFC calls?Watch the recordings here! »

html-webpack-processing-plugin

1.0.1 • Public • Published

html-webpack-processing-plugin

npm NPM Build Status

HTML pre-processing and post-processing for html-webpack-plugin. It supports webpack v4.

Installation

npm install html-webpack-processing-plugin

Usage

  • add pre-processor
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 + "<div></div>";
        return newHTML;
      },
    }),
    new HtmlWebpackProcessingPlugin(),
  ],
};
  • add post-processor
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 + '<div></div>';
        return newHTML;
      }
    }),
    new HtmlWebpackProcessingPlugin()
  ]
};

License

This project is licensed under MIT.

Install

npm i html-webpack-processing-plugin

DownloadsWeekly Downloads

11

Version

1.0.1

License

MIT

Unpacked Size

8.9 kB

Total Files

9

Last publish

Collaborators

  • avatar