Skip to content

Commit 568c853

Browse files
committed
get working with less.js v2 branch
1 parent baee21f commit 568c853

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

lib/clean-css-processor.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,35 @@ module.exports = function(less) {
2424
var cleanOptionArgs = options.split(" ");
2525
options = {};
2626
for(var i = 0; i < cleanOptionArgs.length; i++) {
27-
var argSplit = cleanOptionArgs[i].split("=");
28-
switch(argSplit[0]) {
29-
case "--keep-line-breaks":
30-
case "-b":
27+
var argSplit = cleanOptionArgs[i].split("="),
28+
argName = argSplit[0].replace(/^-+/,"");
29+
switch(argName) {
30+
case "keep-line-breaks":
31+
case "b":
3132
options.keepBreaks = true;
3233
break;
33-
case "--s0":
34+
case "s0":
3435
options.keepSpecialComments = 0;
3536
break;
36-
case "--s1":
37+
case "s1":
3738
options.keepSpecialComments = 1;
3839
break;
39-
case "--skip-advanced":
40+
case "skip-advanced":
4041
options.noAdvanced = true;
4142
break;
42-
case "--advanced":
43+
case "advanced":
4344
options.noAdvanced = false;
4445
break;
45-
case "--compatibility":
46+
case "compatibility":
4647
options.compatibility = argSplit[1];
4748
break;
48-
case "--rounding-precision":
49+
case "rounding-precision":
4950
options.roundingPrecision = Number(argSplit[1]);
5051
break;
5152
default:
5253
console.log("unrecognised clean-css option '" + argSplit[0] + "'");
53-
console.log("we support only arguments that make sense for less, '--keep-line-breaks', '-b'");
54-
console.log("'--s0', '--s1', '--advanced', '--skip-advanced', '--compatibility', '--rounding-precision'");
54+
console.log("we support only arguments that make sense for less, 'keep-line-breaks', 'b'");
55+
console.log("'s0', 's1', 'advanced', 'skip-advanced', 'compatibility', 'rounding-precision'");
5556
throw new Error();
5657
}
5758
}

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "less-plugin-clean-css",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "clean-css plugin for less.js",
55
"homepage": "http://lesscss.org",
66
"author": {
@@ -30,7 +30,6 @@
3030
"clean-css": "2.2.x"
3131
},
3232
"devDependencies": {
33-
"less": ">=2.0.0"
3433
},
3534
"keywords": [
3635
"less plugins",

0 commit comments

Comments
 (0)