From fc56975b3aceaf607dba0c357579345c2bee3a64 Mon Sep 17 00:00:00 2001 From: leeight Date: Tue, 19 Mar 2013 18:26:59 +0800 Subject: [PATCH] ENABLE max-line-len options support --- bin/lessc | 8 ++++++++ lib/less/lessc_helper.js | 1 + lib/less/parser.js | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/lessc b/bin/lessc index da4a1c97..3566cf5b 100755 --- a/bin/lessc +++ b/bin/lessc @@ -12,6 +12,7 @@ var options = { depends: false, compress: false, yuicompress: false, + max_line_len: -1, optimization: 1, silent: false, verbose: false, @@ -76,6 +77,12 @@ args = args.filter(function (arg) { case 'yui-compress': options.yuicompress = true; break; + case 'max-line-len': + options.max_line_len = parseInt(match[2], 10); + if (options.max_line_len <= 0) { + options.max_line_len = -1; + } + break; case 'no-color': options.color = false; break; @@ -199,6 +206,7 @@ var parseLessFile = function (e, data) { ieCompat: options.ieCompat, compress: options.compress, yuicompress: options.yuicompress, + max_line_len: options.max_line_len, strictMaths: options.strictMaths, strictUnits: options.strictUnits }); diff --git a/lib/less/lessc_helper.js b/lib/less/lessc_helper.js index 5d207224..26ebf92c 100644 --- a/lib/less/lessc_helper.js +++ b/lib/less/lessc_helper.js @@ -40,6 +40,7 @@ var lessc_helper = { sys.puts(" -v, --version Print version number and exit."); sys.puts(" -x, --compress Compress output by removing some whitespaces."); sys.puts(" --yui-compress Compress output using ycssmin"); + sys.puts(" --max-line-len Max line length used by ycssmin"); sys.puts(" -O0, -O1, -O2 Set the parser's optimization level. The lower"); sys.puts(" the number, the less nodes it will create in the"); sys.puts(" tree. This could matter for debugging, or if you"); diff --git a/lib/less/parser.js b/lib/less/parser.js index b14465f9..64ba4fd0 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -422,7 +422,7 @@ less.Parser = function Parser(env) { } if (options.yuicompress && less.mode === 'node') { - return require('ycssmin').cssmin(css); + return require('ycssmin').cssmin(css, options.max_line_len); } else if (options.compress) { return css.replace(/(\s)+/g, "$1"); } else {