Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use options.detail to log path and filename #162

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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~~

Expand Down
5 changes: 3 additions & 2 deletions src/inject/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) + '.');
}
}

Expand Down