Gathering detailed insights and metrics for replace-string-loader
Gathering detailed insights and metrics for replace-string-loader
Gathering detailed insights and metrics for replace-string-loader
Gathering detailed insights and metrics for replace-string-loader
string-replace-loader
Replace loader for Webpack
@types/string-replace-loader
TypeScript definitions for string-replace-loader
webpack-replace-loader
A loader for replacing strings && 一个 Webpack 打包时用来替换字符串的 Loader
regexp-replace-loader
A webpack loader to replace a regexp pattern with a string
npm install replace-string-loader
Typescript
Module System
Node Version
NPM Version
70.5
Supply Chain
98.1
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
242,647
Last Day
12
Last Week
472
Last Month
3,055
Last Year
43,952
2 Stars
21 Commits
3 Watching
1 Branches
1 Contributors
Latest Version
0.0.7
Package Id
replace-string-loader@0.0.7
Size
2.28 kB
NPM Version
3.10.3
Node Version
6.6.0
Cumulative downloads
Total Downloads
Last day
-90.2%
12
Compared to previous day
Last week
-39.9%
472
Compared to previous week
Last month
-11.8%
3,055
Compared to previous month
Last year
-12.7%
43,952
Compared to previous year
No dependencies detected.
npm install --save-dev replace-string-loader
options: {
search: "string or /regExp/",
replace: "string or function",
flags: "string",
file: bool
}
search: a string or a regular expression that will be found and replaced in the file.
replace: a string or a function for replacing.
If an options.replace is a function: this function recieves next arguments:
match – a found match,
p1, p2, ..., pn – string content (if exist),
offset – position where the match was found,
s – a basic string.
The function must return a string!!!
flags: regExp flags (g, i, m). Used if options.search is a string and ignored if options.search is a regular expression.
file: if true - a found result will save to the file.
Searching and replacing '105px' to '200px' in scss files: Result will be saved to a json file.
module: {
rules: [{
test: /\.scss$/,
use[{
loader: 'replace-string-loader',
options: {
search: '105px',
replace: '200px',
flags: 'g',
file: true
}
}]
}]
}
An output json file:
{
"file": "[last-file-folder][file-name].[ext]",
"fullFilePath": "full-path-to-file/[file-name].[ext]",
"matches": [
{
"matchLine": 12,
"matchContent": "min-height: 105px;",
"replaceTo": "min-height: 200px;"
},
{
"matchLine": 22,
"matchContent": "min-height: 105px;",
"replaceTo": "min-height: 200px;"
}
]
}
or, without saving into the file
module: {
rules: [{
test: /\.scss$/,
use[{
loader: 'replace-string-loader',
options: {
search: /105px/g,
replace: '200px',
file: false
}
}]
}]
}
Searching and replacing 'exampleVarA' to 'exampleVarB' in js files:
module: {
rules: [{
test: /\.js$/,
use[{
loader: 'replace-string-loader',
options: {
search: /exampleVarA/g,
replace: 'exampleVarB'
}
}]
}]
}
Searching and replacing '105px' to '1050px' in css files:
module: {
rules: [{
test: /\.css$/,
use[{
loader: 'replace-string-loader',
options: {
search: '105px',
replace: function(match){ return `${parseInt(match) * 10}px`;}
}
}]
}]
}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/21 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
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
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-12-23
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