1 |
|
2 | var green, log, magenta, map, path, print, _ref;
|
3 |
|
4 | map = require('map-stream');
|
5 |
|
6 | _ref = require('colors'), green = _ref.green, magenta = _ref.magenta;
|
7 |
|
8 | path = require('path');
|
9 |
|
10 | log = function() {
|
11 | var args, sig;
|
12 | sig = "[" + (green('gulp')) + "]";
|
13 | args = Array.prototype.slice.call(arguments);
|
14 | args.unshift(sig);
|
15 | return console.log.apply(console, args);
|
16 | };
|
17 |
|
18 | print = function(options) {
|
19 | var colors, format;
|
20 | if (options == null) {
|
21 | options = {};
|
22 | }
|
23 | if (typeof options === 'function') {
|
24 | options = {
|
25 | format: options
|
26 | };
|
27 | }
|
28 | format = options.format, colors = options.colors;
|
29 | if (colors == null) {
|
30 | colors = true;
|
31 | }
|
32 | if (format == null) {
|
33 | format = function(filepath) {
|
34 | return filepath;
|
35 | };
|
36 | }
|
37 | return map(function(file, cb) {
|
38 | var filepath, formatted;
|
39 | filepath = path.relative(process.cwd(), file.path);
|
40 | if (colors !== false) {
|
41 | filepath = magenta(filepath);
|
42 | }
|
43 | formatted = format(filepath);
|
44 | if (formatted) {
|
45 | print.log(formatted);
|
46 | }
|
47 | return cb(null, file);
|
48 | });
|
49 | };
|
50 |
|
51 | print.log = log;
|
52 |
|
53 | module.exports = print;
|