npm

Bring the best of OSS JavaScript development to your projects with npm Orgs - private packages & team management tools.Learn more »

gulp-change

1.0.2 • Public • Published

gulp-change

File content change utility for GulpJS.

Allow to easily alter the content of a Gulp files stream with a sync/async callback

npm install gulp-change

Sync Usage

var gulp = require('gulp');
var change = require('change');

function performChange(content) {
    return content.replace(/foo/g, 'FOO');
}

gulp.task('change', function() {
    return gulp.src('src/*.html')
        .pipe(change(performChange))
        .pipe(gulp.dest('build/'))
});

Async Usage

var gulp = require('gulp');
var change = require('change');

function performChange(content, done) {
    content.replace(/foo/g, 'FOO');
    done(null, content);
}

gulp.task('change', function() {
    return gulp.src('src/*.html')
        .pipe(change(performChange))
        .pipe(gulp.dest('build/'))
});

Callback Context

The callback receive a custom context (this) populated with:

file

original file object from Gulp' stream

fname

file name

originalContent

original file content

install

npm i gulp-change

Downloadsweekly downloads

4,736

version

1.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability