mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
(new) css compression support
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user