Created
May 14, 2014 08:59
-
-
Save mikaelbr/2b68012e2b2695466a26 to your computer and use it in GitHub Desktop.
Example of gulp plugin for logging files found (untested and hammered down in few seconds)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var through = require("through2"); | |
var gutil = require("gulp-util"); | |
// gulp-filesfound | |
module.exports = function(verbose) { | |
verbose = !!verbose; | |
var found = []; | |
return through.obj(function (file, enc, next) { | |
found.push(file); | |
this.push(file); | |
next(); | |
}, function () { | |
verbose && prettyPrint(found); | |
gutil.log("filesfound", "Total Found " + found.length); | |
}); | |
}; | |
function prettyPrint (files) { | |
files.forEach(function (file) { | |
gutil.log("filesfound", ":: File ", file.relative) | |
}); | |
} | |
// Somewhere in gulpfile.js | |
var found = require("./gulp-filesfound"); // or where ever | |
gulp.src("somePath/here") | |
.pipe(found(true)) | |
.pipe(whatEverelse()) | |
.pipe(gulp.dest....) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment