less 3.7.0 → 3.9.0

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/Gruntfile.js +45 -7
  3. package/bin/lessc +24 -5
  4. package/dist/less.js +644 -210
  5. package/dist/less.min.js +7 -7
  6. package/lib/less/constants.js +13 -0
  7. package/lib/less/contexts.js +38 -10
  8. package/lib/less/default-options.js +1 -1
  9. package/lib/less/functions/color.js +84 -41
  10. package/lib/less/functions/data-uri.js +1 -1
  11. package/lib/less/functions/list.js +44 -9
  12. package/lib/less/import-manager.js +3 -3
  13. package/lib/less/index.js +1 -1
  14. package/lib/less/parse.js +1 -1
  15. package/lib/less/parser/parser.js +2 -9
  16. package/lib/less/source-map-output.js +2 -2
  17. package/lib/less/tree/color.js +58 -18
  18. package/lib/less/tree/declaration.js +1 -1
  19. package/lib/less/tree/expression.js +1 -1
  20. package/lib/less/tree/import.js +9 -8
  21. package/lib/less/tree/operation.js +1 -1
  22. package/lib/less/tree/url.js +12 -8
  23. package/lib/less/tree/variable-call.js +6 -3
  24. package/lib/less/utils.js +36 -26
  25. package/lib/less-browser/add-default-options.js +4 -0
  26. package/lib/less-browser/index.js +9 -2
  27. package/lib/less-node/image-size.js +1 -1
  28. package/lib/less-node/lessc-helper.js +2 -1
  29. package/package.json +5 -3
  30. package/test/browser/css/rewrite-urls/urls.css +36 -0
  31. package/test/browser/css/rootpath-rewrite-urls/urls.css +35 -0
  32. package/test/browser/less/rewrite-urls/urls.less +34 -0
  33. package/test/browser/less/rootpath-rewrite-urls/urls.less +33 -0
  34. package/test/browser/less.js +644 -210
  35. package/test/browser/runner-rewrite-urls-options.js +3 -0
  36. package/test/browser/runner-rewrite-urls-spec.js +3 -0
  37. package/test/browser/runner-rootpath-relative-spec.js +1 -1
  38. package/test/browser/runner-rootpath-rewrite-urls-options.js +4 -0
  39. package/test/browser/runner-rootpath-rewrite-urls-spec.js +3 -0
  40. package/test/css/colors.css +20 -3
  41. package/test/css/css-escapes.css +3 -0
  42. package/test/css/functions-each.css +34 -0
  43. package/test/css/functions.css +4 -4
  44. package/test/css/rewrite-urls-all/rewrite-urls-all.css +17 -0
  45. package/test/css/rewrite-urls-local/rewrite-urls-local.css +17 -0
  46. package/test/css/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.css +17 -0
  47. package/test/css/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.css +17 -0
  48. package/test/css/static-urls/urls.css +2 -2
  49. package/test/css/urls.css +2 -2
  50. package/test/index.js +8 -2
  51. package/test/less/colors.less +18 -0
  52. package/test/less/css-escapes.less +4 -0
  53. package/test/less/errors/color-func-invalid-color.txt +1 -1
  54. package/test/less/functions-each.less +51 -1
  55. package/test/less/rewrite-urls-all/folder/file.less +8 -0
  56. package/test/less/rewrite-urls-all/rewrite-urls-all.less +11 -0
  57. package/test/less/rewrite-urls-local/folder/file.less +8 -0
  58. package/test/less/rewrite-urls-local/rewrite-urls-local.less +11 -0
  59. package/test/less/rootpath-rewrite-urls-all/folder/file.less +8 -0
  60. package/test/less/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.less +11 -0
  61. package/test/less/rootpath-rewrite-urls-local/folder/file.less +8 -0
  62. package/test/less/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.less +11 -0
  63. package/test/less/sourcemaps/custom-props.less +8 -0
  64. package/test/less-bom/colors.less +18 -0
  65. package/test/less-bom/css-escapes.less +4 -0
  66. package/test/less-bom/errors/color-func-invalid-color.txt +1 -1
  67. package/test/less-bom/functions-each.less +51 -1
  68. package/test/less-bom/rewrite-urls-all/folder/file.less +8 -0
  69. package/test/less-bom/rewrite-urls-all/rewrite-urls-all.less +11 -0
  70. package/test/less-bom/rewrite-urls-local/folder/file.less +8 -0
  71. package/test/less-bom/rewrite-urls-local/rewrite-urls-local.less +11 -0
  72. package/test/less-bom/rootpath-rewrite-urls-all/folder/file.less +8 -0
  73. package/test/less-bom/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.less +11 -0
  74. package/test/less-bom/rootpath-rewrite-urls-local/folder/file.less +8 -0
  75. package/test/less-bom/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.less +11 -0
  76. package/test/less-bom/sourcemaps/custom-props.less +8 -0
  77. package/test/less-test.js +26 -12
  78. package/test/sourcemaps/custom-props.json +1 -0
  79. package/.npmignore +0 -8
  80. package/lib/less/math-constants.js +0 -6
  81. package/test/css/3rd-party/bootstrap.css +0 -6814
  82. package/test/less/3rd-party/bootstrap.less +0 -1
  83. package/test/less/errors/color-invalid-hex-code.less +0 -4
  84. package/test/less/errors/color-invalid-hex-code.txt +0 -4
  85. package/test/less/errors/color-invalid-hex-code2.less +0 -4
  86. package/test/less/errors/color-invalid-hex-code2.txt +0 -4
  87. package/test/less-bom/3rd-party/bootstrap.less +0 -1
  88. package/test/less-bom/errors/color-invalid-hex-code.less +0 -4
  89. package/test/less-bom/errors/color-invalid-hex-code.txt +0 -4
  90. package/test/less-bom/errors/color-invalid-hex-code2.less +0 -4
  91. package/test/less-bom/errors/color-invalid-hex-code2.txt +0 -4
@@ -0,0 +1,3 @@
1
+ var less = {logLevel: 4,
2
+ errorReporting: 'console'};
3
+ less.rewriteUrls = 'all';
@@ -0,0 +1,3 @@
1
+ describe("less.js browser test - rewrite urls", function() {
2
+ testLessEqualsInDocument();
3
+ });
@@ -1,3 +1,3 @@
1
- describe('less.js browser test - rootpath and relative url\'s', function() {
1
+ describe('less.js browser test - rootpath and relative urls', function() {
2
2
  testLessEqualsInDocument();
3
3
  });
@@ -0,0 +1,4 @@
1
+ var less = {logLevel: 4,
2
+ errorReporting: 'console'};
3
+ less.rootpath = 'https://www.github.com/cloudhead/less.js/';
4
+ less.rewriteUrls = 'all';
@@ -0,0 +1,3 @@
1
+ describe('less.js browser test - rootpath and rewrite urls', function() {
2
+ testLessEqualsInDocument();
3
+ });
@@ -23,7 +23,7 @@
23
23
  color: #1a0000ff;
24
24
  }
25
25
  #alpha #hsla {
26
- color: rgba(61, 45, 41, 0.6);
26
+ color: hsla(11, 20%, 20%, 0.6);
27
27
  }
28
28
  #overflow .a {
29
29
  color: #000000;
@@ -47,10 +47,10 @@
47
47
  color: #333333;
48
48
  }
49
49
  #808080 {
50
- color: #808080;
50
+ color: hsl(0, 0%, 50%);
51
51
  }
52
52
  #00ff00 {
53
- color: #00ff00;
53
+ color: hsl(120, 100%, 50%);
54
54
  }
55
55
  .lightenblue {
56
56
  color: #3333ff;
@@ -85,3 +85,20 @@
85
85
  color: 255;
86
86
  border-color: rgba(255, 0, 0, 0.5);
87
87
  }
88
+ #rrggbbaa {
89
+ test-1: #55FF5599;
90
+ test-2: #5F59;
91
+ test-3: rgba(136, 255, 136, 0.6);
92
+ test-4: rgba(85, 255, 85, 0.1);
93
+ test-5: rgba(85, 255, 85, 0.6);
94
+ test-6: rgba(85, 255, 85, 0.6);
95
+ test-7: rgba(85, 255, 85, 0.5);
96
+ test-8: rgba(var(--color-accent), 0.2);
97
+ test-9: rgb(var(--color-accent));
98
+ test-9: hsla(var(--color-accent));
99
+ test-10: #55FF5599;
100
+ test-11: hsla(120, 100%, 66.66666667%, 0.6);
101
+ test-12: hsla(120, 100%, 66.66666667%, 0.5);
102
+ --semi-transparent-dark-background: #001e00ee;
103
+ --semi-transparent-dark-background-2: #001e00;
104
+ }
@@ -25,3 +25,6 @@ ng\:form {
25
25
  .bootstrap {
26
26
  background-color: #000 \9;
27
27
  }
28
+ textarea {
29
+ font-family: 'helvetica neue', 'wenquanyi micro hei', \5FAE\8F6F\96C5\9ED1, \5B8B\4F53, sans-serif;
30
+ }
@@ -40,9 +40,43 @@
40
40
  val2: 2;
41
41
  val3: 4;
42
42
  }
43
+ .column-list {
44
+ list: 1 2 3 4;
45
+ }
46
+ .col-1 {
47
+ width: 25%;
48
+ }
49
+ .col-2 {
50
+ width: 25%;
51
+ }
52
+ .col-3 {
53
+ width: 25%;
54
+ }
55
+ .col-4 {
56
+ width: 25%;
57
+ }
58
+ .row-1 {
59
+ width: 10px;
60
+ }
61
+ .row-2 {
62
+ width: 20px;
63
+ }
64
+ .row-3 {
65
+ width: 30px;
66
+ }
43
67
  .box {
44
68
  -less-log: a;
45
69
  -less-log: b;
46
70
  -less-log: c;
47
71
  -less-log: d;
48
72
  }
73
+ .test {
74
+ color: blue;
75
+ color: red;
76
+ }
77
+ .foo {
78
+ content: red;
79
+ }
80
+ .bar {
81
+ content: blue;
82
+ }
@@ -17,9 +17,9 @@
17
17
  desaturate: #29332f;
18
18
  desaturate-relative: #233930;
19
19
  greyscale: #2e2e2e;
20
- hsl-clamp: #ffffff;
21
- spin-p: #bf6a40;
22
- spin-n: #bf4055;
20
+ hsl-clamp: hsl(0, 0%, 100%);
21
+ spin-p: hsl(20, 50%, 50%);
22
+ spin-n: hsl(350, 50%, 50%);
23
23
  luma-white: 100%;
24
24
  luma-black: 0%;
25
25
  luma-black-alpha: 0%;
@@ -168,7 +168,7 @@
168
168
  case-insensitive-2: true;
169
169
  }
170
170
  #alpha {
171
- alpha: rgba(153, 94, 51, 0.6);
171
+ alpha: hsla(25, 50%, 40%, 0.6);
172
172
  alpha2: 0.5;
173
173
  alpha3: 0;
174
174
  }
@@ -0,0 +1,17 @@
1
+ #imported-file {
2
+ background-image: url("./folder/relative/path");
3
+ background-image: url("./relative/path");
4
+ background-image: url("../relative/path");
5
+ background-image: url("folder/module");
6
+ background-image: url("folder/module/path");
7
+ background-image: url("folder/module/relative/path");
8
+ }
9
+ #rewrite-urls-all {
10
+ background-image: url("./relative/path");
11
+ background-image: url("../relative/path");
12
+ background-image: url("./path");
13
+ background-image: url("./");
14
+ background-image: url("module");
15
+ background-image: url("module/path");
16
+ background-image: url("module/relative/path");
17
+ }
@@ -0,0 +1,17 @@
1
+ #imported-file {
2
+ background-image: url("./folder/relative/path");
3
+ background-image: url("./relative/path");
4
+ background-image: url("../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/relative/path");
8
+ }
9
+ #rewrite-urls-local {
10
+ background-image: url("./relative/path");
11
+ background-image: url("../relative/path");
12
+ background-image: url("./path");
13
+ background-image: url("./");
14
+ background-image: url("module");
15
+ background-image: url("module/path");
16
+ background-image: url("module/relative/path");
17
+ }
@@ -0,0 +1,17 @@
1
+ #imported-file {
2
+ background-image: url("http://example.com/assets/css/folder/relative/path");
3
+ background-image: url("http://example.com/assets/css/relative/path");
4
+ background-image: url("http://example.com/assets/relative/path");
5
+ background-image: url("http://example.com/assets/css/folder/module");
6
+ background-image: url("http://example.com/assets/css/folder/module/path");
7
+ background-image: url("http://example.com/assets/css/folder/module/relative/path");
8
+ }
9
+ #rootpath-rewrite-urls-all {
10
+ background-image: url("http://example.com/assets/css/relative/path");
11
+ background-image: url("http://example.com/assets/relative/path");
12
+ background-image: url("http://example.com/assets/css/path");
13
+ background-image: url("http://example.com/assets/css");
14
+ background-image: url("http://example.com/assets/css/module");
15
+ background-image: url("http://example.com/assets/css/module/path");
16
+ background-image: url("http://example.com/assets/css/module/relative/path");
17
+ }
@@ -0,0 +1,17 @@
1
+ #imported-file {
2
+ background-image: url("http://example.com/assets/css/folder/relative/path");
3
+ background-image: url("http://example.com/assets/css/relative/path");
4
+ background-image: url("http://example.com/assets/relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/relative/path");
8
+ }
9
+ #rootpath-rewrite-urls-local {
10
+ background-image: url("http://example.com/assets/css/relative/path");
11
+ background-image: url("http://example.com/assets/relative/path");
12
+ background-image: url("http://example.com/assets/css/path");
13
+ background-image: url("http://example.com/assets/css");
14
+ background-image: url("module");
15
+ background-image: url("module/path");
16
+ background-image: url("module/relative/path");
17
+ }
@@ -30,12 +30,12 @@
30
30
  #logo {
31
31
  width: 100px;
32
32
  height: 100px;
33
- background: url('assets/logo.png');
33
+ background: url('./assets/logo.png');
34
34
  background: url("#inline-svg");
35
35
  }
36
36
  @font-face {
37
37
  font-family: xecret;
38
- src: url('assets/xecret.ttf');
38
+ src: url('./assets/xecret.ttf');
39
39
  }
40
40
  #secret {
41
41
  font-family: xecret, sans-serif;
package/test/css/urls.css CHANGED
@@ -38,12 +38,12 @@
38
38
  #logo {
39
39
  width: 100px;
40
40
  height: 100px;
41
- background: url('import/assets/logo.png');
41
+ background: url('./import/assets/logo.png');
42
42
  background: url("#inline-svg");
43
43
  }
44
44
  @font-face {
45
45
  font-family: xecret;
46
- src: url('import/assets/xecret.ttf');
46
+ src: url('./import/assets/xecret.ttf');
47
47
  }
48
48
  #secret {
49
49
  font-family: xecret, sans-serif;
package/test/index.js CHANGED
@@ -9,8 +9,9 @@ lessTester.prepBomTest();
9
9
  var testMap = [
10
10
  [{}, 'namespacing/'],
11
11
  [{
12
- relativeUrls: true,
13
- silent: true,
12
+ // TODO: Change this to rewriteUrls: 'all' once the relativeUrls option is removed
13
+ relativeUrls: true,
14
+ silent: true,
14
15
  javascriptEnabled: true,
15
16
  // Set explicitly for legacy tests for >3.0
16
17
  ieCompat: true
@@ -37,6 +38,7 @@ var testMap = [
37
38
  function(name) { return name + '-mediaquery'; }],
38
39
  [{math: 'strict', dumpLineNumbers: 'all'}, 'debug/', null,
39
40
  function(name) { return name + '-all'; }],
41
+ // TODO: Change this to rewriteUrls: false once the relativeUrls option is removed
40
42
  [{math: 'strict', relativeUrls: false, rootpath: 'folder (1)/'}, 'static-urls/'],
41
43
  [{math: 'strict', compress: true}, 'compression/'],
42
44
  [{math: 0, strictUnits: true}, 'strict-units/'],
@@ -56,6 +58,10 @@ var testMap = [
56
58
  [{modifyVars: true}, 'modifyVars/',
57
59
  null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; }],
58
60
  [{urlArgs: '424242'}, 'url-args/'],
61
+ [{rewriteUrls: 'all'}, 'rewrite-urls-all/'],
62
+ [{rewriteUrls: 'local'}, 'rewrite-urls-local/'],
63
+ [{rootpath: 'http://example.com/assets/css/', rewriteUrls: 'all'}, 'rootpath-rewrite-urls-all/'],
64
+ [{rootpath: 'http://example.com/assets/css/', rewriteUrls: 'local'}, 'rootpath-rewrite-urls-local/'],
59
65
  [{paths: ['test/data/', 'test/less/import/']}, 'include-path/'],
60
66
  [{paths: 'test/data/'}, 'include-path-string/'],
61
67
  [{plugin: 'test/plugins/postprocess/'}, 'postProcessorPlugin/'],
@@ -96,3 +96,21 @@
96
96
  color: red(rgb(100%, 0, 0));
97
97
  border-color: rgba(100%, 0, 0, 50%);
98
98
  }
99
+
100
+ #rrggbbaa {
101
+ test-1: #55FF5599;
102
+ test-2: #5F59;
103
+ test-3: lighten(#55FF5599, 10%);
104
+ test-4: fade(#5F59, 10%);
105
+ test-5: rgba(#55FF5599);
106
+ test-6: rgba(#5F59);
107
+ test-7: rgba(#5F59, 0.5);
108
+ test-8: rgba(var(--color-accent), 0.2);
109
+ test-9: rgb(var(--color-accent));
110
+ test-9: hsla(var(--color-accent));
111
+ test-10: color('#55FF5599');
112
+ test-11: hsla(#5F59);
113
+ test-12: hsla(#5F59, 0.5);
114
+ --semi-transparent-dark-background: #001e00ee;
115
+ --semi-transparent-dark-background-2: rgba(0, 30, 0, 238); // invalid opacity will be capped
116
+ }
@@ -35,4 +35,8 @@ ng\:form {
35
35
  // In Bootstrap v3
36
36
  .bootstrap {
37
37
  background-color: #000 \9;
38
+ }
39
+
40
+ textarea {
41
+ font-family: 'helvetica neue','wenquanyi micro hei',\5FAE\8F6F\96C5\9ED1, \5B8B\4F53, sans-serif;
38
42
  }
@@ -1,4 +1,4 @@
1
- ArgumentError: error evaluating function `color`: argument must be a color keyword or 3/6 digit hex e.g. #FFF in {path}color-func-invalid-color.less on line 2, column 10:
1
+ ArgumentError: error evaluating function `color`: argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF in {path}color-func-invalid-color.less on line 2, column 10:
2
2
  1 .test {
3
3
  2 color: color("NOT A COLOR");
4
4
  3 }
@@ -38,8 +38,11 @@ each(@selectors, {
38
38
 
39
39
  @set: {
40
40
  one: blue;
41
+ // skip comments
41
42
  two: green;
42
- three: red;
43
+ /** and these
44
+ */
45
+ three: red; //and this
43
46
  }
44
47
  .set {
45
48
  each(@set, {
@@ -73,9 +76,56 @@ each(@selectors, {
73
76
  });
74
77
  }
75
78
 
79
+ @columns: range(4);
80
+ .column-list {
81
+ list: @columns;
82
+ }
83
+
84
+ each(@columns, .(@val) {
85
+ .col-@{val} {
86
+ width: (100% / length(@columns));
87
+ }
88
+ });
89
+
90
+ each(range(10px, 30px, 10px), .(@val, @index) {
91
+ .row-@{index} {
92
+ width: @val;
93
+ }
94
+ });
95
+
76
96
  @list: a b c d;
77
97
  .box {
78
98
  each(@list, {
79
99
  -less-log: extract(@list, @index);
80
100
  })
81
101
  }
102
+
103
+ // https://github.com/less/less.js/issues/3325
104
+
105
+ @color-schemes: {
106
+ @primary: {
107
+ @color: blue;
108
+ }
109
+ @secondary: {
110
+ @color: red;
111
+ }
112
+ }
113
+ .test {
114
+ each(primary secondary, .(@color-name) {
115
+ @scheme: @color-schemes[@@color-name]; // e.g. @color-name = primary
116
+ color: @scheme[@color];
117
+ });
118
+ }
119
+
120
+ @one: {
121
+ @two: {
122
+ foo: red;
123
+ bar: blue;
124
+ };
125
+ };
126
+
127
+ each(@one[@two], {
128
+ .@{key} {
129
+ content: @value;
130
+ }
131
+ });
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }
@@ -0,0 +1,11 @@
1
+ @import "./folder/file.less";
2
+
3
+ #rewrite-urls-all {
4
+ background-image: url("./relative/path");
5
+ background-image: url("../relative/path");
6
+ background-image: url("./relative/../path");
7
+ background-image: url("./relative/../path/..");
8
+ background-image: url("module");
9
+ background-image: url("module/path");
10
+ background-image: url("module/path/../relative/path");
11
+ }
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }
@@ -0,0 +1,11 @@
1
+ @import "./folder/file.less";
2
+
3
+ #rewrite-urls-local {
4
+ background-image: url("./relative/path");
5
+ background-image: url("../relative/path");
6
+ background-image: url("./relative/../path");
7
+ background-image: url("./relative/../path/..");
8
+ background-image: url("module");
9
+ background-image: url("module/path");
10
+ background-image: url("module/path/../relative/path");
11
+ }
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }
@@ -0,0 +1,11 @@
1
+ @import "./folder/file.less";
2
+
3
+ #rootpath-rewrite-urls-all {
4
+ background-image: url("./relative/path");
5
+ background-image: url("../relative/path");
6
+ background-image: url("./relative/../path");
7
+ background-image: url("./relative/../path/..");
8
+ background-image: url("module");
9
+ background-image: url("module/path");
10
+ background-image: url("module/path/../relative/path");
11
+ }
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }
@@ -0,0 +1,11 @@
1
+ @import "./folder/file.less";
2
+
3
+ #rootpath-rewrite-urls-local {
4
+ background-image: url("./relative/path");
5
+ background-image: url("../relative/path");
6
+ background-image: url("./relative/../path");
7
+ background-image: url("./relative/../path/..");
8
+ background-image: url("module");
9
+ background-image: url("module/path");
10
+ background-image: url("module/path/../relative/path");
11
+ }
@@ -0,0 +1,8 @@
1
+ @color: var(--foo);
2
+
3
+ body {
4
+ border-left: 1px solid @color;
5
+ width: calc(50% - 5px);
6
+ border-top: 1px solid @color;
7
+ }
8
+
@@ -96,3 +96,21 @@
96
96
  color: red(rgb(100%, 0, 0));
97
97
  border-color: rgba(100%, 0, 0, 50%);
98
98
  }
99
+
100
+ #rrggbbaa {
101
+ test-1: #55FF5599;
102
+ test-2: #5F59;
103
+ test-3: lighten(#55FF5599, 10%);
104
+ test-4: fade(#5F59, 10%);
105
+ test-5: rgba(#55FF5599);
106
+ test-6: rgba(#5F59);
107
+ test-7: rgba(#5F59, 0.5);
108
+ test-8: rgba(var(--color-accent), 0.2);
109
+ test-9: rgb(var(--color-accent));
110
+ test-9: hsla(var(--color-accent));
111
+ test-10: color('#55FF5599');
112
+ test-11: hsla(#5F59);
113
+ test-12: hsla(#5F59, 0.5);
114
+ --semi-transparent-dark-background: #001e00ee;
115
+ --semi-transparent-dark-background-2: rgba(0, 30, 0, 238); // invalid opacity will be capped
116
+ }
@@ -35,4 +35,8 @@ ng\:form {
35
35
  // In Bootstrap v3
36
36
  .bootstrap {
37
37
  background-color: #000 \9;
38
+ }
39
+
40
+ textarea {
41
+ font-family: 'helvetica neue','wenquanyi micro hei',\5FAE\8F6F\96C5\9ED1, \5B8B\4F53, sans-serif;
38
42
  }
@@ -1,4 +1,4 @@
1
- ArgumentError: error evaluating function `color`: argument must be a color keyword or 3/6 digit hex e.g. #FFF in {path}color-func-invalid-color.less on line 2, column 10:
1
+ ArgumentError: error evaluating function `color`: argument must be a color keyword or 3|4|6|8 digit hex e.g. #FFF in {path}color-func-invalid-color.less on line 2, column 10:
2
2
  1 .test {
3
3
  2 color: color("NOT A COLOR");
4
4
  3 }
@@ -38,8 +38,11 @@ each(@selectors, {
38
38
 
39
39
  @set: {
40
40
  one: blue;
41
+ // skip comments
41
42
  two: green;
42
- three: red;
43
+ /** and these
44
+ */
45
+ three: red; //and this
43
46
  }
44
47
  .set {
45
48
  each(@set, {
@@ -73,9 +76,56 @@ each(@selectors, {
73
76
  });
74
77
  }
75
78
 
79
+ @columns: range(4);
80
+ .column-list {
81
+ list: @columns;
82
+ }
83
+
84
+ each(@columns, .(@val) {
85
+ .col-@{val} {
86
+ width: (100% / length(@columns));
87
+ }
88
+ });
89
+
90
+ each(range(10px, 30px, 10px), .(@val, @index) {
91
+ .row-@{index} {
92
+ width: @val;
93
+ }
94
+ });
95
+
76
96
  @list: a b c d;
77
97
  .box {
78
98
  each(@list, {
79
99
  -less-log: extract(@list, @index);
80
100
  })
81
101
  }
102
+
103
+ // https://github.com/less/less.js/issues/3325
104
+
105
+ @color-schemes: {
106
+ @primary: {
107
+ @color: blue;
108
+ }
109
+ @secondary: {
110
+ @color: red;
111
+ }
112
+ }
113
+ .test {
114
+ each(primary secondary, .(@color-name) {
115
+ @scheme: @color-schemes[@@color-name]; // e.g. @color-name = primary
116
+ color: @scheme[@color];
117
+ });
118
+ }
119
+
120
+ @one: {
121
+ @two: {
122
+ foo: red;
123
+ bar: blue;
124
+ };
125
+ };
126
+
127
+ each(@one[@two], {
128
+ .@{key} {
129
+ content: @value;
130
+ }
131
+ });
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }
@@ -0,0 +1,11 @@
1
+ @import "./folder/file.less";
2
+
3
+ #rewrite-urls-all {
4
+ background-image: url("./relative/path");
5
+ background-image: url("../relative/path");
6
+ background-image: url("./relative/../path");
7
+ background-image: url("./relative/../path/..");
8
+ background-image: url("module");
9
+ background-image: url("module/path");
10
+ background-image: url("module/path/../relative/path");
11
+ }
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }
@@ -0,0 +1,11 @@
1
+ @import "./folder/file.less";
2
+
3
+ #rewrite-urls-local {
4
+ background-image: url("./relative/path");
5
+ background-image: url("../relative/path");
6
+ background-image: url("./relative/../path");
7
+ background-image: url("./relative/../path/..");
8
+ background-image: url("module");
9
+ background-image: url("module/path");
10
+ background-image: url("module/path/../relative/path");
11
+ }
@@ -0,0 +1,8 @@
1
+ #imported-file {
2
+ background-image: url("./relative/path");
3
+ background-image: url("../relative/path");
4
+ background-image: url("../../relative/path");
5
+ background-image: url("module");
6
+ background-image: url("module/path");
7
+ background-image: url("module/path/../relative/path");
8
+ }