Skip to content

Commit

Permalink
Fix --verbose flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 14, 2017
1 parent f122670 commit cb0069c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,12 @@ class Output {
const unoptimizedImages = res.formattedResults.ruleResults.OptimizeImages.urlBlocks;
const desktopWeights = this.compareWeights(yourImageWeight / 1000, this.outputData.desktop, this.outputData.titles);
const mobileWeights = this.compareWeights(yourImageWeight / 1000, this.outputData.mobile, this.outputData.titles);
const unoptimizedUrls = unoptimizedImages[0] && unoptimizedImages[0].urls;
let imagesToOptimize = '';

if (opts.verbose && unoptimizedImages[1] !== undefined) {
unoptimizedImages[1].urls.forEach(url => {
url.result.args.forEach(x => {
if (opts.verbose && unoptimizedUrls && unoptimizedUrls.length > 0) {
for (const url of unoptimizedUrls) {
for (const x of url.result.args) {
let result = '';

switch (x.type) {
Expand All @@ -166,8 +167,8 @@ class Output {
}

imagesToOptimize += result + '\n';
});
});
}
}
}

console.log([
Expand Down

0 comments on commit cb0069c

Please sign in to comment.