less 1.4.0-b3 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.npmignore CHANGED
@@ -0,0 +1 @@
1
+ .gitattributes
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ # 1.4.2
2
+
3
+ 2013-07-20
4
+
5
+ - if you don't pass a strict maths option, font size/line height options are output correctly again
6
+ - npmignore now include .gitattributes
7
+ - property names may include capital letters
8
+ - various windows path fixes (capital letters, multiple // in a path)
9
+
10
+ # 1.4.1
11
+
12
+ 2013-07-05
13
+
14
+ - fix syncImports and yui-compress option, as they were being ignored
15
+ - fixed several global variable leaks
16
+ - handle getting null or undefined passed as the options object
17
+
18
+ # 1.4.0
19
+
20
+ 2013-06-05
21
+
22
+ - fix passing of strict maths option
23
+
24
+ # 1.4.0 Beta 4
25
+
26
+ 2013-05-04
27
+
28
+ - change strictMaths to strictMath. Enable this with --strict-math=on in lessc and strictMath:true in JavaScript.
29
+ - change lessc option for strict units to --strict-units=off
30
+
1
31
  # 1.4.0 Beta 3
2
32
 
3
33
  2013-04-30
package/CONTRIBUTING.md CHANGED
@@ -46,4 +46,4 @@ _Pull requests are encouraged!_
46
46
  ## Developing
47
47
  If you want to take an issue just add a small comment saying you are having a go at something, so we don't get duplication.
48
48
 
49
- Learn more about [developing Less.js](https://github.com/cloudhead/less.js/wiki/Developing-less.js).
49
+ Learn more about [developing Less.js](https://github.com/less/less.js/wiki/Developing-less.js).
package/README.md CHANGED
@@ -10,7 +10,7 @@ about
10
10
 
11
11
  This is the JavaScript, and now official, stable version of LESS.
12
12
 
13
- For more information on the language and usage visit [lesscss.org](http://lesscss.org). More information also available [in our wiki](https://github.com/cloudhead/less.js/wiki)
13
+ For more information on the language and usage visit [lesscss.org](http://lesscss.org). More information also available [in our wiki](https://github.com/less/less.js/wiki)
14
14
 
15
15
  license
16
16
  -------
package/bin/lessc CHANGED
@@ -23,7 +23,8 @@ var options = {
23
23
  rootpath: '',
24
24
  relativeUrls: false,
25
25
  ieCompat: true,
26
- strictMaths: true
26
+ strictMath: false,
27
+ strictUnits: false
27
28
  };
28
29
  var continueProcessing = true,
29
30
  currentErrorcode;
@@ -39,7 +40,17 @@ var checkArgFunc = function(arg, option) {
39
40
  return false;
40
41
  }
41
42
  return true;
42
- }
43
+ };
44
+
45
+ var checkBooleanArg = function(arg) {
46
+ var onOff = /^((on|t|true|y|yes)|(off|f|false|n|no))$/i.exec(arg);
47
+ if (!onOff) {
48
+ sys.puts(" unable to parse "+arg+" as a boolean. use one of on/t/true/y/yes/off/f/false/n/no");
49
+ continueProcessing = false;
50
+ return false;
51
+ }
52
+ return Boolean(onOff[2]);
53
+ };
43
54
 
44
55
  args = args.filter(function (arg) {
45
56
  var match;
@@ -49,7 +60,7 @@ args = args.filter(function (arg) {
49
60
  return false;
50
61
  }
51
62
 
52
- if (match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=([^\s]+))?$/i)) { arg = match[1] }
63
+ if (match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=([^\s]*))?$/i)) { arg = match[1] }
53
64
  else { return arg }
54
65
 
55
66
  switch (arg) {
@@ -129,12 +140,16 @@ args = args.filter(function (arg) {
129
140
  options.relativeUrls = true;
130
141
  break;
131
142
  case "sm":
132
- case "strict-maths-off":
133
- options.strictMaths = false;
143
+ case "strict-math":
144
+ if (checkArgFunc(arg, match[2])) {
145
+ options.strictMath = checkBooleanArg(match[2]);
146
+ }
134
147
  break;
135
148
  case "su":
136
- case "strict-units-off":
137
- options.strictUnits = false;
149
+ case "strict-units":
150
+ if (checkArgFunc(arg, match[2])) {
151
+ options.strictUnits = checkBooleanArg(match[2]);
152
+ }
138
153
  break;
139
154
  }
140
155
  });
@@ -214,7 +229,7 @@ var parseLessFile = function (e, data) {
214
229
  compress: options.compress,
215
230
  yuicompress: options.yuicompress,
216
231
  maxLineLen: options.maxLineLen,
217
- strictMaths: options.strictMaths,
232
+ strictMath: options.strictMath,
218
233
  strictUnits: options.strictUnits
219
234
  });
220
235
  if (output) {
@@ -3124,7 +3124,7 @@ tree.Expression.prototype = {
3124
3124
  if (inParenthesis) {
3125
3125
  env.outOfParenthesis();
3126
3126
  }
3127
- if (this.parens && this.parensInOp && !(env.isMathsOn()) && !doubleParen) {
3127
+ if (this.parens && this.parensInOp && !(env.isMathOn()) && !doubleParen) {
3128
3128
  returnValue = new(tree.Paren)(returnValue);
3129
3129
  }
3130
3130
  return returnValue;
@@ -3392,17 +3392,17 @@ tree.Media.prototype = {
3392
3392
  this.ruleset.debugInfo = this.debugInfo;
3393
3393
  media.debugInfo = this.debugInfo;
3394
3394
  }
3395
- var strictMathsBypass = false;
3396
- if (env.strictMaths === false) {
3397
- strictMathsBypass = true;
3398
- env.strictMaths = true;
3395
+ var strictMathBypass = false;
3396
+ if (!env.strictMath) {
3397
+ strictMathBypass = true;
3398
+ env.strictMath = true;
3399
3399
  }
3400
3400
  try {
3401
3401
  media.features = this.features.eval(env);
3402
3402
  }
3403
3403
  finally {
3404
- if (strictMathsBypass) {
3405
- env.strictMaths = false;
3404
+ if (strictMathBypass) {
3405
+ env.strictMath = false;
3406
3406
  }
3407
3407
  }
3408
3408
 
@@ -3742,7 +3742,7 @@ tree.Negative.prototype = {
3742
3742
  return '-' + this.value.toCSS(env);
3743
3743
  },
3744
3744
  eval: function (env) {
3745
- if (env.isMathsOn()) {
3745
+ if (env.isMathOn()) {
3746
3746
  return (new(tree.Operation)('*', [new(tree.Dimension)(-1), this.value])).eval(env);
3747
3747
  }
3748
3748
  return new(tree.Negative)(this.value.eval(env));
@@ -3767,7 +3767,7 @@ tree.Operation.prototype = {
3767
3767
  b = this.operands[1].eval(env),
3768
3768
  temp;
3769
3769
 
3770
- if (env.isMathsOn()) {
3770
+ if (env.isMathOn()) {
3771
3771
  if (a instanceof tree.Dimension && b instanceof tree.Color) {
3772
3772
  if (this.op === '*' || this.op === '+') {
3773
3773
  temp = b, b = a, a = temp;
@@ -3903,10 +3903,10 @@ tree.Rule.prototype = {
3903
3903
  }
3904
3904
  },
3905
3905
  eval: function (env) {
3906
- var strictMathsBypass = false;
3907
- if (this.name === "font" && env.strictMaths === false) {
3908
- strictMathsBypass = true;
3909
- env.strictMaths = true;
3906
+ var strictMathBypass = false;
3907
+ if (this.name === "font" && env.strictMath === false) {
3908
+ strictMathBypass = true;
3909
+ env.strictMath = true;
3910
3910
  }
3911
3911
  try {
3912
3912
  return new(tree.Rule)(this.name,
@@ -3915,8 +3915,8 @@ tree.Rule.prototype = {
3915
3915
  this.index, this.currentFileInfo, this.inline);
3916
3916
  }
3917
3917
  finally {
3918
- if (strictMathsBypass) {
3919
- env.strictMaths = false;
3918
+ if (strictMathBypass) {
3919
+ env.strictMath = false;
3920
3920
  }
3921
3921
  }
3922
3922
  },
@@ -4646,7 +4646,7 @@ tree.jsify = function (obj) {
4646
4646
  'verbose', // whether to log more activity
4647
4647
  'compress', // whether to compress
4648
4648
  'ieCompat', // whether to enforce IE compatibility (IE8 data-uri)
4649
- 'strictMaths', // whether maths has to be within parenthesis
4649
+ 'strictMath', // whether math has to be within parenthesis
4650
4650
  'strictUnits' // whether units need to evaluate correctly
4651
4651
  ];
4652
4652
 
@@ -4667,8 +4667,8 @@ tree.jsify = function (obj) {
4667
4667
  this.parensStack.pop();
4668
4668
  };
4669
4669
 
4670
- tree.evalEnv.prototype.isMathsOn = function () {
4671
- return this.strictMaths === false ? true : (this.parensStack && this.parensStack.length);
4670
+ tree.evalEnv.prototype.isMathOn = function () {
4671
+ return this.strictMath ? (this.parensStack && this.parensStack.length) : true;
4672
4672
  };
4673
4673
 
4674
4674
  tree.evalEnv.prototype.isPathRelative = function (path) {