Fix error output and extract a helper object for lessc related methods

- Fixed a bug, which prevents colors from being set in error messages.
- Created a helper object for lessc methods and moved the stylize function
  into it. Changed test/less-test.js and lib/less/index.js to use new methods.
- Removed duplicate definitions of the stylize function.
This commit is contained in:
Matt
2012-08-15 13:23:04 +12:00
committed by Luke Page
parent b65d420353
commit 5132c71a5b
4 changed files with 30 additions and 35 deletions

View File

@@ -3,6 +3,7 @@ var path = require('path'),
sys = require('util');
var less = require('../lib/less');
var stylize = require('../lib/less/lessc_helper').stylize;
var oneTestOnly = process.argv[2];
@@ -112,18 +113,3 @@ function toCSS(path, callback) {
});
});
}
// Stylize a string
function stylize(str, style) {
var styles = {
'reset' : [0, 0],
'bold' : [1, 22],
'inverse' : [7, 27],
'underline' : [4, 24],
'yellow' : [33, 39],
'green' : [32, 39],
'red' : [31, 39]
};
return '\033[' + styles[style][0] + 'm' + str +
'\033[' + styles[style][1] + 'm';
}