Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
gulp-replace-fix
Advanced tools
A string replace plugin for gulp 3
First, install gulp-replace
as a development dependency:
npm install --save-dev gulp-replace
Then, add it to your gulpfile.js
:
var replace = require('gulp-replace');
gulp.task('templates', function(){
gulp.src(['file.txt'])
.pipe(replace(/foo(.{3})/g, '$1foo'))
.pipe(gulp.dest('build/file.txt'));
});
var replace = require('gulp-replace');
gulp.task('templates', function(){
gulp.src(['file.txt'])
.pipe(replace(/foo(.{3})/g, function($0, str){
return str + 'foo' + this.filePath;
}, {passFileName: true}))
.pipe(gulp.dest('build/file.txt'));
});
var replace = require('gulp-replace');
gulp.task('templates', function(){
gulp.src(['file.txt'])
.pipe(replace('bar', 'foo'))
.pipe(gulp.dest('build/file.txt'));
});
gulp-replace can be called with a string or regex.
Type: String
The string to search for.
Type: String
or Function
The replacement string or function. If replacement
is a function, it will be called once for each match and will be passed the string that is to be replaced.
Type: RegExp
The regex pattern to search for. See the MDN documentation for RegExp for details.
Type: String
or Function
The replacement string or function. See the MDN documentation for String.replace for details.
if Function
and options.passFileName
is true, then Function within the filePath is equal to the current file file.path
.
An optional third argument, options
, can be passed.
Type: Object
Type: boolean
Default: false
Skip binary files
Type: boolean
Default: false
Passes full file path to the replacement function
FAQs
A string replace plugin for gulp
The npm package gulp-replace-fix receives a total of 1 weekly downloads. As such, gulp-replace-fix popularity was classified as not popular.
We found that gulp-replace-fix demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.