From 80e91b4ed8afa682fee087c1c373b9e78e42afb4 Mon Sep 17 00:00:00 2001 From: barsh Date: Mon, 1 Feb 2016 11:40:15 -0600 Subject: [PATCH] use options.detail to log path and filename --- README.md | 13 +++++++++++++ src/inject/index.js | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 758ba7c..27f983e 100644 --- a/README.md +++ b/README.md @@ -749,6 +749,19 @@ Default: `false` Affects the default `options.transform` function, see above. +#### options.detail +Type: `Boolean` + +Default: `false` + +Set to `true` to log path and filename: + +`gulp-inject 1 files into {path}{filename.htm}` + +Instead of: + +`gulp-inject 1 files into {filename.htm}` + #### ~~options.templateString~~ diff --git a/src/inject/index.js b/src/inject/index.js index 35ec0ea..eef33b6 100644 --- a/src/inject/index.js +++ b/src/inject/index.js @@ -43,6 +43,7 @@ module.exports = exports = function(sources, opt){ // Defaults: opt.quiet = bool(opt, 'quiet', false); + opt.detail = bool(opt, 'detail', false); opt.ignorePath = toArray(opt.ignorePath).map(unixify); opt.relative = bool(opt, 'relative', false); opt.addRootSlash = bool(opt, 'addRootSlash', !opt.relative); @@ -156,9 +157,9 @@ function getNewContent (target, collection, opt) { var oldContent = target.contents; if (!opt.quiet) { if (!collection.length) { - log('Nothing to inject into ' + magenta(target.relative) + '.'); + log('Nothing to inject into ' + magenta(opt.detail ? path.relative(target.relative, target.path) : target.relative) + '.'); } else { - log(cyan(collection.length) + ' files into ' + magenta(target.relative) + '.'); + log(cyan(collection.length) + ' files into ' + magenta(opt.detail ? path.relative(target.relative, target.path) : target.relative) + '.'); } }