Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed colors for non term environments

  • Loading branch information...
commit 3aab1731de52f254b51152947eabb89d6b1690ce 1 parent 649df8e
@davglass davglass authored
Showing with 10 additions and 3 deletions.
  1. +10 −3 bin/yuglify
View
13 bin/yuglify
@@ -14,6 +14,7 @@ var nopt = require('nopt'),
pack = require('../package.json'),
jsmin = require('../').jsmin,
cssmin = require('../').cssmin,
+ hasColor = process.stdin.isTTY,
defaults = {
name: '%s.min%s'
},
@@ -147,8 +148,14 @@ if (parsed.terminal) {
fs.writeFileSync(combined, buffer[type].replace(/(\n|\r)/gi, ''), 'utf8');
- // Those bizarre sets of characters are for coloring the output.
- console.log('Generated combined ' + type.toUpperCase() + ' file: \u001b[32m' + combined + '\033[0m');
+ var log = 'Generated combined ' + type.toUpperCase() + ' file: ';
+ if (hasColor) {
+ // Those bizarre sets of characters are for coloring the output.
+ log += '\u001b[32m' + combined + '\033[0m';
+ } else {
+ log += combined;
+ }
+ console.log(log);
}
@@ -159,4 +166,4 @@ if (parsed.terminal) {
}
-}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.