Skip to content

deep-fish-pixel/html-replace-all-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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!'
    }
  }]
})

About

webpack plugin for replace HTML contents in all operates, such as string、regExp、object

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published