/interpolate-html-plugin

Webpack plugin for interpolating variables into templated HTML file

Primary LanguageTypeScriptApache License 2.0Apache-2.0

@k88/interpolate-html-plugin

Taken from react-dev-utils, but is published as a standalone plugin and has Typescript definition.

Installation

Install using

npm install @k88/interpolate-html-plugin

This is an extension to html-webpack-plugin, so you also need to install the dependenc.

Usage

You can use %VARIABLE_NAME% within your template HTML file and then use this plugin to replace them:

module.exports = {
  ...webpackConfig,
  plugins: [
    new InterpolateHtmlPlugin({
      'NODE_ENV': 'development',
      'VARIABLE_NAME': 'some-variable-value',
    }),
  ],
}