1.0.1 • Published 6 years ago

html-replace-all-webpack-plugin v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

html-replace-all-webpack-plugin

This support all replace html operates in webpack by string or regexp.

Install

$ npm install --save html-replace-all-webpack-plugin

Usage

replace one match
new HtmlReplaceWebpackPlugin({
  matches: [{
    match: /<body>/,
    value: `<body>hello World!`,
  }]
})
replace two match
new HtmlReplaceWebpackPlugin({
  matches: [{
    matchStart: /<body>/,
    matchEnd: /<\/body>/,
    value: `<body>hello World!</body>`,
  }]
})
replace object all values by properties
new HtmlReplaceWebpackPlugin({
  matchObjects: [{
    prefix: '${',
    suffix: '}',
    target: {
      title: 'Test matchObject',
      content: 'hello World!'
    }
  }]
})