Gathering detailed insights and metrics for gulp-replace-string
Gathering detailed insights and metrics for gulp-replace-string
Gathering detailed insights and metrics for gulp-replace-string
Gathering detailed insights and metrics for gulp-replace-string
Replaces strings on files by using string or regex patterns.
npm install gulp-replace-string
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
39 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Sep 23, 2018
Latest Version
0.6.1
Package Id
gulp-replace-string@0.6.1
Unpacked Size
23.26 kB
Size
6.67 kB
File Count
6
NPM Version
5.6.0
Node Version
10.1.0
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
4
Replaces strings in files by using string or regex patterns.
You'll actually want to instead use @yodasws/gulp-pattern-replace (npm). It provides extra flexability and smaller dependency tree.
Forked this off gulp-string-replace because I wanted to be able to pass all the arguments/options in a single options object argument.
1yarn add --dev gulp-replace-string
1npm install --save-dev gulp-replace-string
1var replace = require('gulp-replace-string'); 2 3gulp.task('replace_1', () => { 4 gulp.src(["./config.js"]) 5 .pipe(replace(new RegExp('@env@', 'g'), 'production')) 6 .pipe(gulp.dest('./build/config.js')) 7}); 8 9gulp.task('replace_2', () => { 10 gulp.src(["./index.html"]) 11 .pipe(replace(/version(={1})/g, '$1v0.2.2')) 12 .pipe(gulp.dest('./build/index.html')) 13}); 14 15gulp.task('replace_3', () => { 16 gulp.src(["./config.js"]) 17 .pipe(replace(/foo/g, () => 'bar')) 18 .pipe(gulp.dest('./build/config.js')) 19});
1gulp.task('replace_1', () => { 2 gulp.src(["./config.js"]) 3 .pipe(replace('@env@', 'production')) 4 .pipe(gulp.dest('./build/config.js')) 5});
1gulp.task('replace_1', () => { 2 gulp.src(["./config.js"]) 3 .pipe(replace('@env@', () => { 4 return argv.env === 'dev' ? 'dev' : 'production'; 5 })) 6 .pipe(gulp.dest('./build/config.js')) 7}); 8 9gulp.task('replace_2', () => { 10 gulp.src(["./config.js"]) 11 .pipe(replace('environment', (pattern) => { 12 return pattern + '_mocked'; 13 })) 14 .pipe(gulp.dest('./build/config.js')) 15});
1var options = { 2 pattern: /@env@/g 3 replacement: 'dev', 4 logs: { 5 enabled: false 6 } 7}; 8 9gulp.task('replace_1', () => { 10 gulp.src(["./config.js"]) 11 .pipe(replace(options) 12 .pipe(gulp.dest('./build/config.js')) 13});
1gulp.task('lint-js', () => { 2 gulp.src(["./config.js"]) 3 .pipe(replace([/(if|for|switch|while)\(/g, '$1 (') 4 .pipe(gulp.dest('./build/config.js')); 5});
Type: Object
Type: String
or RegExp
The string to search for.
Type: String
or Function
The replacement string or function. Called once for each match. Function has access to regex outcome (all arguments are passed).
More details here: [MDN documentation for RegExp] and [MDN documentation for String.replace].
Type: Boolean
or Object
Output logs.
true
is the same as:
1logs: { 2 enabled: true, 3 notReplaced: false, 4}
Type: Boolean
, Default: true
Output logs.
Type: Boolean
, Default: false
Output "not replaced" logs.
Type: String
or RegExp
The string to search for.
Type: String
or Function
The replacement string or function. Called once for each match. Function has access to regex outcome (all arguments are passed).
Type: Object
Same as above, but without properties pattern
or replacement
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
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
branch protection not enabled on development/release branches
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