Gathering detailed insights and metrics for webpack-content-replacer-plugin
Gathering detailed insights and metrics for webpack-content-replacer-plugin
Gathering detailed insights and metrics for webpack-content-replacer-plugin
Gathering detailed insights and metrics for webpack-content-replacer-plugin
⭐️ Plugin that replace content in file in a webpack workflow
npm install webpack-content-replacer-plugin
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (98.45%)
HTML (1.24%)
CSS (0.32%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
15 Stars
36 Commits
7 Forks
3 Watchers
1 Branches
4 Contributors
Updated on Aug 24, 2023
Latest Version
0.5.1
Package Id
webpack-content-replacer-plugin@0.5.1
Size
5.20 kB
NPM Version
3.10.10
Node Version
6.10.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
13
1
Replace content in file in webpack workflow
Edit file by replacing content at different build step in a webpack workflow.
For example, you can change text color, text content or also insert configuration values from environment variables.
1npm i webpack-content-replacer-plugin
Require webpack-content-replacer-plugin
1var ContentReplacerWebpackPlugin = require('webpack-content-replacer-plugin')
Add the plugin to your plugin list
1var config = { 2 plugins: [ 3 new ContentReplacerWebpackPlugin({ 4 modifiedFile: './relative_path/file_to_be_modified.ext', 5 modifications: [ 6 { 7 regex: /%content_to_be_deleted%/g, 8 modification: 'new_content', 9 }, 10 { 11 regex: /%content2_to_be_deleted%/g, 12 modification: 'new_content2', 13 }, 14 ], 15 }) 16 ] 17}
String
Specify the file which will be modified.
Example:
1var config = { 2 plugins: [ 3 new ContentReplacerWebpackPlugin({ 4 modifiedFile: './build/index.html', 5 ... 6 }) 7 ] 8}
Array<Modification>
Specify the modifications to be applied to the file.
Example:
1var config = { 2 plugins: [ 3 new ContentReplacerWebpackPlugin({ 4 modifiedFile: './build/index.html', 5 [ 6 { 7 regex: /text/g, 8 modification: 'new text' 9 } 10 ], 11 ... 12 }) 13 ] 14}
Object
Example:
1{ 2 regex: /text/g, 3 modification: 'new text' 4}
String
after-emit
after-emit
, done
Specify webpack build step (c.f plugin documentation).
Example:
1var config = { 2 plugins: [ 3 new ContentReplacerWebpackPlugin({ 4 modifiedFile: './build/index.html', 5 [ 6 { 7 regex: /text/g, 8 modification: 'new text' 9 } 10 ], 11 buildTrigger: 'done', 12 ... 13 }) 14 ] 15}
String
strict
strict
, log
, none
strict
: catch errors in an exception, the webpack build crasheslog
: log errors in a log file (warning.log
) and none behaviornone
: show errors in console (when silent mode is off)Specify behavior when the plugin fail.
Example:
1var config = { 2 plugins: [ 3 new ContentReplacerWebpackPlugin({ 4 modifiedFile: './build/index.html', 5 [ 6 { 7 regex: /text/g, 8 modification: 'new text' 9 } 10 ], 11 buildTrigger: 'done', 12 logLevel: 'log' 13 ... 14 }) 15 ] 16}
Boolean
false
Display/hide info logs during the build.
Example:
1var config = { 2 plugins: [ 3 new ContentReplacerWebpackPlugin({ 4 silent: true, 5 modifiedFile: './build/index.html', 6 [ 7 { 8 regex: /text/g, 9 modification: 'new text' 10 } 11 ], 12 buildTrigger: 'done' 13 ], 14 }) 15 ] 16}
1git clone https://github.com/{your fork}/webpack-content-replacer-plugin.git 2cd webpack-content-replacer-plugin/ 3npm install
Replace {your fork}
by your github username.
If you'd like to contribute, please fork the repository and use a feature
branch. All contributions are welcome. Please make a pull request and make sure things still pass after running npm test
.
Ensure you've read the contribution guidelines for more information and respect the code of conduct
Thanks goes to these wonderful people (emoji key):
Sebastien Correaud 🚇 💻 📖 ⚠️ 👀 | YQBird 📖 ⚠️ 👀 |
---|
This project follows the all-contributors specification. Contributions of any kind welcome!
The code in this project is licensed under MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More