1 | map = require 'map-stream'
|
2 | {green, magenta} = require 'colors'
|
3 | path = require 'path'
|
4 |
|
5 | log = ->
|
6 | sig = "[#{green('gulp')}]"
|
7 | args = Array.prototype.slice.call arguments
|
8 | args.unshift sig
|
9 |
|
10 | console.log.apply console, args
|
11 |
|
12 | print = (options = {}) ->
|
13 | options = format: options if typeof options is 'function'
|
14 | {format, colors} = options
|
15 | colors ?= yes
|
16 | format ?= (filepath) -> filepath
|
17 |
|
18 | map (file, cb) ->
|
19 | filepath = path.relative process.cwd(), file.path
|
20 | filepath = magenta(filepath) if colors isnt false
|
21 | formatted = format filepath
|
22 | print.log formatted if formatted
|
23 | cb null, file
|
24 |
|
25 | print.log = log
|
26 |
|
27 | module.exports = print
|