Skip to content

Commit fc56975

Browse files
leeightlukeapage
authored andcommitted
ENABLE max-line-len options support
1 parent 285f4ac commit fc56975

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

bin/lessc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var options = {
1212
depends: false,
1313
compress: false,
1414
yuicompress: false,
15+
max_line_len: -1,
1516
optimization: 1,
1617
silent: false,
1718
verbose: false,
@@ -76,6 +77,12 @@ args = args.filter(function (arg) {
7677
case 'yui-compress':
7778
options.yuicompress = true;
7879
break;
80+
case 'max-line-len':
81+
options.max_line_len = parseInt(match[2], 10);
82+
if (options.max_line_len <= 0) {
83+
options.max_line_len = -1;
84+
}
85+
break;
7986
case 'no-color':
8087
options.color = false;
8188
break;
@@ -199,6 +206,7 @@ var parseLessFile = function (e, data) {
199206
ieCompat: options.ieCompat,
200207
compress: options.compress,
201208
yuicompress: options.yuicompress,
209+
max_line_len: options.max_line_len,
202210
strictMaths: options.strictMaths,
203211
strictUnits: options.strictUnits
204212
});

lib/less/lessc_helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ var lessc_helper = {
4040
sys.puts(" -v, --version Print version number and exit.");
4141
sys.puts(" -x, --compress Compress output by removing some whitespaces.");
4242
sys.puts(" --yui-compress Compress output using ycssmin");
43+
sys.puts(" --max-line-len Max line length used by ycssmin");
4344
sys.puts(" -O0, -O1, -O2 Set the parser's optimization level. The lower");
4445
sys.puts(" the number, the less nodes it will create in the");
4546
sys.puts(" tree. This could matter for debugging, or if you");

lib/less/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ less.Parser = function Parser(env) {
422422
}
423423

424424
if (options.yuicompress && less.mode === 'node') {
425-
return require('ycssmin').cssmin(css);
425+
return require('ycssmin').cssmin(css, options.max_line_len);
426426
} else if (options.compress) {
427427
return css.replace(/(\s)+/g, "$1");
428428
} else {

0 commit comments

Comments
 (0)