Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including agnitio-as-gulp-replace with all npm packages installed. Try it out:

var agnitioAsGulpReplace = require("agnitio-as-gulp-replace")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

agnitio-as-gulp-replace v1.3.0

gulp-replace for Agnitio

gulp-replace NPM version Build status

A string replace plugin for gulp 3

This is a fork of original gulp module

The only difference is the addition of file.path as second parameter to replacement function.


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(){
    .pipe(replace(/foo(.{3})/g, '$1foo'))


gulp-replace can be called with a string or regex.

replace(string, replacement[, options])


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.

replace(regex, replacement[, options])


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.

gulp-replace options

An optional third argument, options, can be passed.


Type: Object


Type: boolean
Default: false

Skip binary files

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free