diff --git a/bin/lessc b/bin/lessc index c2b1628..2f6588c 100755 --- a/bin/lessc +++ b/bin/lessc @@ -24,6 +24,9 @@ args = args.filter(function (arg) { case 'version': sys.puts("lessc " + less.version.join('.') + " (LESS Compiler) [JavaScript]"); process.exit(0); + case 'verbose': + options.verbose = true; + break; case 'h': case 'help': sys.puts("usage: lessc source [destination]"); diff --git a/lib/less/index.js b/lib/less/index.js index e01efb8..8286a8a 100644 --- a/lib/less/index.js +++ b/lib/less/index.js @@ -36,11 +36,12 @@ var less = { } }, writeError: function (ctx) { + var message = ""; var extract = ctx.extract; var error = []; - if (ctx.stack) { - return require('sys').error(ctx.stack); + if (!ctx.index && ctx.stack) { + return sys.error(ctx.stack); } if (typeof(extract[0]) === 'string') { @@ -56,8 +57,12 @@ var less = { } error = error.join('\n') + '\033[0m\n'; - require('sys').error(stylize(ctx.message + ' of ', 'red') + - ctx.filename + ': ', error); + message += stylize(ctx.message, 'red'); + ctx.filename && (message += stylize(' in ', 'red') + ctx.filename); + + sys.error(message, error); + + if (ctx.verbose && ctx.stack) { sys.error(stylize(ctx.stack, 'red')) } } }; diff --git a/lib/less/parser.js b/lib/less/parser.js index a2a98c3..da424ff 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -238,9 +238,11 @@ less.Parser = function Parser(env) { throw { name: "NameError", message: e.message, + filename: env.filename, line: line, stack: e.stack, column: column, + verbose: env.verbose, extract: [ lines[line - 2], lines[line - 1],