Skip to content

Instantly share code, notes, and snippets.

@mikaelbr
Created May 14, 2014 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikaelbr/2b68012e2b2695466a26 to your computer and use it in GitHub Desktop.
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)
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