ENABLE max-line-len options support

This commit is contained in:
leeight
2013-03-19 18:26:59 +08:00
committed by Luke Page
parent 285f4ac820
commit fc56975b3a
3 changed files with 10 additions and 1 deletions

View File

@@ -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
});

View File

@@ -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");

View File

@@ -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 {