mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
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:
@@ -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';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user