‚̧Newtonian Physics Mockumentary
    Wondering what‚Äôs next for npm?Check out our public roadmap! ¬Ľ

    gulp-fncallback

    2.0.2¬†‚Äʬ†Public¬†‚Äʬ†Published

    gulp-fncallback

    Add own callback to streaming Build Status

    Install

    npm install gulp-fncallback
    

    Usage transformFunction

    var less = require('gulp-less');
    var callback = require('gulp-fncallback');
     
    gulp.task('less', function () {
      gulp.src('./less/**/*.less')
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(callback(function (file, enc, cb) {
          console.log(file);
          cb();
        }))
        .pipe(gulp.dest('./public/css'));
    });

    Usage transformFunction and flushFunction

    var less = require('gulp-less');
    var callback = require('gulp-fncallback');
     
    gulp.task('less', function () {
      gulp.src('./less/**/*.less')
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(callback(function (file, enc, cb) {
          console.log(file);
          cb();
        }, function (callback) {
          callback();
        }))
        .pipe(gulp.dest('./public/css'));
    });

    Usage transformFunction with error

    var less = require('gulp-less');
    var callback = require('gulp-fncallback');
     
    gulp.task('less', function () {
      gulp.src('./less/**/*.less')
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(callback(function (file, enc, cb) {
          console.log(file);
          cb('error');
        }))
        .pipe(gulp.dest('./public/css'));
    });

    Usage transformFunction with new file

    var less = require('gulp-less');
    var callback = require('gulp-fncallback');
     
    gulp.task('less', function () {
      gulp.src('./less/**/*.less')
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(callback(function (file, enc, cb) {
          var newFile = ...
          cb(null, newFile);
        }))
        .pipe(gulp.dest('./public/css'));
    });

    Usage transformFunction with new file and append old file

    var less = require('gulp-less');
    var callback = require('gulp-fncallback');
     
    gulp.task('less', function () {
      gulp.src('./less/**/*.less')
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(callback(function (file, enc, cb) {
          var newFile = ...
          cb(null, newFile, true);
        }))
        .pipe(gulp.dest('./public/css'));
    });

    Options

    once - Run callback once

    var less = require('gulp-less');
    var callback = require('gulp-fncallback');
     
    gulp.task('less', function () {
      gulp.src('./less/**/*.less')
        .pipe(less({
          paths: [ path.join(__dirname, 'less', 'includes') ]
        }))
        .pipe(callback(function (file, enc, cb) {
          console.log(file);
          cb();
        }, {
          once: true
        }))
        .pipe(gulp.dest('./public/css'));
    });

    Install

    npm i gulp-fncallback

    DownloadsWeekly Downloads

    6

    Version

    2.0.2

    License

    MIT

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar