Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including html-webpack-string-replace-plugin with all npm packages installed. Try it out:

var htmlWebpackStringReplacePlugin = require("html-webpack-string-replace-plugin")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

html-webpack-string-replace-plugin v1.1.0

Perform string replacements when using the html webpack plugin

String Replace for the HTML Webpack Plugin

npm version

This webpack plugin is to be used in conjunction with html-webpack-plugin. It provides a way for us to use webpack to copy HTML files and perform string manipulations


Install the plugin with npm:

$ npm install -D html-webpack-string-replace-plugin


Require the plugin in your webpack config:

const HtmlWebpackStringReplacePlugin = require('html-webpack-string-replace-plugin');

Add the plugin to your webpack config as follows:

plugins: [
    new HtmlWebpackPlugin({
      "template": "./src/login.html",
      "filename": "./login.html",

    new HtmlWebpackStringReplacePlugin({
      '_VERSION_': '1.0',
      '_CDN_': 'https://some-cdn',
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free