-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.js
37 lines (28 loc) · 853 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict';
var through = require('through2');
var gutil = require('gulp-util');
module.exports = function filelog (taskParam) {
var count = 0;
function decorate (color, text) {
return text ? '[' + gutil.colors[color](text) + ']' : '';
}
return through.obj(function (file, enc, callback) {
var items = [];
count++;
if (taskParam) {
items.push(decorate('blue', taskParam));
}
items.push(decorate('yellow', count));
items.push(decorate('cyan', file.path));
if (file.isNull()) {
items.push(decorate('magenta', 'EMPTY'));
}
gutil.log(items.join(' '));
this.push(file);
return callback();
}, function (cb) {
var task = taskParam ? decorate('blue', taskParam) + ' ' : '';
gutil.log(task + 'Found ' + decorate('yellow', count.toString()) + ' files.');
cb();
});
};