gulp-change
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/gulp-change package

    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,520

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    2.7 kB

    Total Files

    3

    Last publish

    Collaborators

    • marcopeg