(new) css compression support

This commit is contained in:
cloudhead
2010-06-11 21:45:51 -04:00
parent f7050f280f
commit 123440864f
7 changed files with 48 additions and 36 deletions

View File

@@ -213,16 +213,25 @@ less.Parser = function Parser(env) {
root.toCSS = (function (toCSS) {
var line, lines, column;
return function () {
return function (options) {
options = options || {};
try {
return toCSS.call(this);
var css = toCSS.call(this, [], {
frames: [],
compress: options.compress || false
});
if (options.compress) {
return css.replace(/(\s)+/g, "$1");
} else {
return css;
}
} catch (e) {
lines = input.split('\n');
line = (input.slice(0, e.index).match(/\n/g) || "").length + 1;
for (var n = e.index, column = -1;
n >= 0 && input.charAt(n) !== '\n';
n--) { column++ }
throw {
name: "NameError",
message: e.message,