less 2.3.0 → 2.3.1

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 (268) hide show
  1. package/.idea/inspectionProfiles/Project_Default.xml +1 -0
  2. package/.idea/jsLinters/jscs.xml +4 -0
  3. package/.idea/jsLinters/jshint.xml +58 -4
  4. package/.idea/workspace.xml +427 -892
  5. package/.jscsrc +34 -2
  6. package/.jshintrc +0 -1
  7. package/CHANGELOG.md +7 -0
  8. package/bin/lessc +8 -3
  9. package/bower.json +1 -1
  10. package/dist/less.js +362 -245
  11. package/dist/less.min.js +5 -5
  12. package/lib/less/data/unit-conversions.js +3 -3
  13. package/lib/less/environment/abstract-file-manager.js +4 -4
  14. package/lib/less/functions/color-blending.js +3 -3
  15. package/lib/less/functions/color.js +7 -7
  16. package/lib/less/functions/data-uri.js +3 -2
  17. package/lib/less/functions/string.js +3 -1
  18. package/lib/less/functions/svg.js +6 -3
  19. package/lib/less/functions/types.js +3 -1
  20. package/lib/less/import-manager.js +4 -1
  21. package/lib/less/index.js +1 -1
  22. package/lib/less/parser/parser.js +12 -7
  23. package/lib/less/source-map-output.js +3 -3
  24. package/lib/less/transform-tree.js +1 -1
  25. package/lib/less/tree/condition.js +1 -1
  26. package/lib/less/tree/debug-info.js +6 -2
  27. package/lib/less/tree/dimension.js +1 -1
  28. package/lib/less/tree/directive.js +15 -3
  29. package/lib/less/tree/import.js +1 -1
  30. package/lib/less/tree/media.js +3 -2
  31. package/lib/less/tree/mixin-call.js +3 -4
  32. package/lib/less/tree/mixin-definition.js +4 -3
  33. package/lib/less/tree/quoted.js +1 -1
  34. package/lib/less/tree/rule.js +2 -3
  35. package/lib/less/tree/ruleset.js +223 -149
  36. package/lib/less/tree/selector.js +2 -1
  37. package/lib/less/tree/url.js +1 -1
  38. package/lib/less/tree/value.js +1 -1
  39. package/lib/less/tree/variable.js +1 -1
  40. package/lib/less/visitors/extend-visitor.js +30 -22
  41. package/lib/less/visitors/import-visitor.js +2 -1
  42. package/lib/less/visitors/to-css-visitor.js +5 -4
  43. package/lib/less-browser/utils.js +5 -5
  44. package/lib/less-node/file-manager.js +8 -4
  45. package/lib/less-node/url-file-manager.js +2 -2
  46. package/lib/less-rhino/index.js +2 -2
  47. package/package.json +3 -3
  48. package/test/browser/common.js +3 -3
  49. package/test/browser/jasmine-jsreporter.js +2 -2
  50. package/test/browser/less.js +29 -0
  51. package/test/copy-bom.js +14 -8
  52. package/test/css/selectors.css +9 -0
  53. package/test/index.js +1 -1
  54. package/test/less/selectors.less +18 -3
  55. package/test/less-bom/charsets.less +3 -0
  56. package/test/less-bom/colors.less +98 -0
  57. package/test/less-bom/comments.less +102 -0
  58. package/test/less-bom/comments2.less +20 -0
  59. package/test/less-bom/compression/compression.less +36 -0
  60. package/test/less-bom/css-3.less +154 -0
  61. package/test/less-bom/css-escapes.less +33 -0
  62. package/test/less-bom/css-guards.less +103 -0
  63. package/test/less-bom/css.less +108 -0
  64. package/test/less-bom/debug/import/test.less +25 -0
  65. package/test/less-bom/debug/linenumbers.less +33 -0
  66. package/test/less-bom/detached-rulesets.less +103 -0
  67. package/test/less-bom/empty.less +1 -0
  68. package/test/less-bom/errors/add-mixed-units.less +3 -0
  69. package/test/less-bom/errors/add-mixed-units.txt +4 -0
  70. package/test/less-bom/errors/add-mixed-units2.less +3 -0
  71. package/test/less-bom/errors/add-mixed-units2.txt +4 -0
  72. package/test/less-bom/errors/at-rules-undefined-var.less +4 -0
  73. package/test/less-bom/errors/at-rules-undefined-var.txt +4 -0
  74. package/test/less-bom/errors/bad-variable-declaration1.less +1 -0
  75. package/test/less-bom/errors/bad-variable-declaration1.txt +2 -0
  76. package/test/less-bom/errors/color-func-invalid-color.less +3 -0
  77. package/test/less-bom/errors/color-func-invalid-color.txt +4 -0
  78. package/test/less-bom/errors/color-invalid-hex-code.less +3 -0
  79. package/test/less-bom/errors/color-invalid-hex-code.txt +4 -0
  80. package/test/less-bom/errors/color-invalid-hex-code2.less +3 -0
  81. package/test/less-bom/errors/color-invalid-hex-code2.txt +4 -0
  82. package/test/less-bom/errors/css-guard-default-func.less +4 -0
  83. package/test/less-bom/errors/css-guard-default-func.txt +4 -0
  84. package/test/less-bom/errors/detached-ruleset-1.less +6 -0
  85. package/test/less-bom/errors/detached-ruleset-1.txt +4 -0
  86. package/test/less-bom/errors/detached-ruleset-2.less +6 -0
  87. package/test/less-bom/errors/detached-ruleset-2.txt +4 -0
  88. package/test/less-bom/errors/detached-ruleset-3.less +4 -0
  89. package/test/less-bom/errors/detached-ruleset-3.txt +4 -0
  90. package/test/less-bom/errors/detached-ruleset-4.less +5 -0
  91. package/test/less-bom/errors/detached-ruleset-4.txt +4 -0
  92. package/test/less-bom/errors/detached-ruleset-5.less +4 -0
  93. package/test/less-bom/errors/detached-ruleset-5.txt +3 -0
  94. package/test/less-bom/errors/detached-ruleset-6.less +5 -0
  95. package/test/less-bom/errors/detached-ruleset-6.txt +4 -0
  96. package/test/less-bom/errors/divide-mixed-units.less +3 -0
  97. package/test/less-bom/errors/divide-mixed-units.txt +4 -0
  98. package/test/less-bom/errors/extend-no-selector.less +3 -0
  99. package/test/less-bom/errors/extend-no-selector.txt +3 -0
  100. package/test/less-bom/errors/extend-not-at-end.less +3 -0
  101. package/test/less-bom/errors/extend-not-at-end.txt +3 -0
  102. package/test/less-bom/errors/import-malformed.less +1 -0
  103. package/test/less-bom/errors/import-malformed.txt +3 -0
  104. package/test/less-bom/errors/import-missing.less +6 -0
  105. package/test/less-bom/errors/import-missing.txt +3 -0
  106. package/test/less-bom/errors/import-no-semi.less +1 -0
  107. package/test/less-bom/errors/import-no-semi.txt +2 -0
  108. package/test/less-bom/errors/import-subfolder1.less +1 -0
  109. package/test/less-bom/errors/import-subfolder1.txt +3 -0
  110. package/test/less-bom/errors/import-subfolder2.less +1 -0
  111. package/test/less-bom/errors/import-subfolder2.txt +4 -0
  112. package/test/less-bom/errors/imports/import-subfolder1.less +1 -0
  113. package/test/less-bom/errors/imports/import-subfolder2.less +1 -0
  114. package/test/less-bom/errors/imports/import-test.less +4 -0
  115. package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +1 -0
  116. package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +1 -0
  117. package/test/less-bom/errors/javascript-error.less +3 -0
  118. package/test/less-bom/errors/javascript-error.txt +4 -0
  119. package/test/less-bom/errors/javascript-undefined-var.less +3 -0
  120. package/test/less-bom/errors/javascript-undefined-var.txt +4 -0
  121. package/test/less-bom/errors/mixed-mixin-definition-args-1.less +6 -0
  122. package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +4 -0
  123. package/test/less-bom/errors/mixed-mixin-definition-args-2.less +6 -0
  124. package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +4 -0
  125. package/test/less-bom/errors/mixin-not-defined.less +11 -0
  126. package/test/less-bom/errors/mixin-not-defined.txt +3 -0
  127. package/test/less-bom/errors/mixin-not-matched.less +6 -0
  128. package/test/less-bom/errors/mixin-not-matched.txt +3 -0
  129. package/test/less-bom/errors/mixin-not-matched2.less +6 -0
  130. package/test/less-bom/errors/mixin-not-matched2.txt +3 -0
  131. package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +9 -0
  132. package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +4 -0
  133. package/test/less-bom/errors/mixins-guards-default-func-1.less +9 -0
  134. package/test/less-bom/errors/mixins-guards-default-func-1.txt +4 -0
  135. package/test/less-bom/errors/mixins-guards-default-func-2.less +9 -0
  136. package/test/less-bom/errors/mixins-guards-default-func-2.txt +4 -0
  137. package/test/less-bom/errors/mixins-guards-default-func-3.less +9 -0
  138. package/test/less-bom/errors/mixins-guards-default-func-3.txt +4 -0
  139. package/test/less-bom/errors/multiple-guards-on-css-selectors.less +4 -0
  140. package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +4 -0
  141. package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +4 -0
  142. package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +4 -0
  143. package/test/less-bom/errors/multiply-mixed-units.less +7 -0
  144. package/test/less-bom/errors/multiply-mixed-units.txt +4 -0
  145. package/test/less-bom/errors/parens-error-1.less +3 -0
  146. package/test/less-bom/errors/parens-error-1.txt +4 -0
  147. package/test/less-bom/errors/parens-error-2.less +3 -0
  148. package/test/less-bom/errors/parens-error-2.txt +4 -0
  149. package/test/less-bom/errors/parens-error-3.less +3 -0
  150. package/test/less-bom/errors/parens-error-3.txt +4 -0
  151. package/test/less-bom/errors/parse-error-curly-bracket.less +4 -0
  152. package/test/less-bom/errors/parse-error-curly-bracket.txt +4 -0
  153. package/test/less-bom/errors/parse-error-extra-parens.less +5 -0
  154. package/test/less-bom/errors/parse-error-extra-parens.txt +3 -0
  155. package/test/less-bom/errors/parse-error-missing-bracket.less +2 -0
  156. package/test/less-bom/errors/parse-error-missing-bracket.txt +3 -0
  157. package/test/less-bom/errors/parse-error-missing-parens.less +5 -0
  158. package/test/less-bom/errors/parse-error-missing-parens.txt +3 -0
  159. package/test/less-bom/errors/parse-error-with-import.less +13 -0
  160. package/test/less-bom/errors/parse-error-with-import.txt +4 -0
  161. package/test/less-bom/errors/percentage-missing-space.less +3 -0
  162. package/test/less-bom/errors/percentage-missing-space.txt +4 -0
  163. package/test/less-bom/errors/property-asterisk-only-name.less +3 -0
  164. package/test/less-bom/errors/property-asterisk-only-name.txt +4 -0
  165. package/test/less-bom/errors/property-ie5-hack.less +3 -0
  166. package/test/less-bom/errors/property-ie5-hack.txt +3 -0
  167. package/test/less-bom/errors/property-in-root.less +4 -0
  168. package/test/less-bom/errors/property-in-root.txt +4 -0
  169. package/test/less-bom/errors/property-in-root2.less +1 -0
  170. package/test/less-bom/errors/property-in-root2.txt +4 -0
  171. package/test/less-bom/errors/property-in-root3.less +4 -0
  172. package/test/less-bom/errors/property-in-root3.txt +3 -0
  173. package/test/less-bom/errors/property-interp-not-defined.less +1 -0
  174. package/test/less-bom/errors/property-interp-not-defined.txt +2 -0
  175. package/test/less-bom/errors/recursive-variable.less +1 -0
  176. package/test/less-bom/errors/recursive-variable.txt +2 -0
  177. package/test/less-bom/errors/single-character.less +1 -0
  178. package/test/less-bom/errors/single-character.txt +2 -0
  179. package/test/less-bom/errors/svg-gradient1.less +3 -0
  180. package/test/less-bom/errors/svg-gradient1.txt +4 -0
  181. package/test/less-bom/errors/svg-gradient2.less +3 -0
  182. package/test/less-bom/errors/svg-gradient2.txt +4 -0
  183. package/test/less-bom/errors/svg-gradient3.less +3 -0
  184. package/test/less-bom/errors/svg-gradient3.txt +4 -0
  185. package/test/less-bom/errors/unit-function.less +3 -0
  186. package/test/less-bom/errors/unit-function.txt +4 -0
  187. package/test/less-bom/extend-chaining.less +91 -0
  188. package/test/less-bom/extend-clearfix.less +19 -0
  189. package/test/less-bom/extend-exact.less +46 -0
  190. package/test/less-bom/extend-media.less +24 -0
  191. package/test/less-bom/extend-nest.less +65 -0
  192. package/test/less-bom/extend-selector.less +99 -0
  193. package/test/less-bom/extend.less +81 -0
  194. package/test/less-bom/extract-and-length.less +133 -0
  195. package/test/less-bom/functions.less +201 -0
  196. package/test/less-bom/globalVars/extended.json +5 -0
  197. package/test/less-bom/globalVars/extended.less +10 -0
  198. package/test/less-bom/globalVars/simple.json +3 -0
  199. package/test/less-bom/globalVars/simple.less +3 -0
  200. package/test/less-bom/ie-filters.less +15 -0
  201. package/test/less-bom/import/deeper/deeper-2/url-import-2.less +3 -0
  202. package/test/less-bom/import/deeper/deeper-2/url-import.less +1 -0
  203. package/test/less-bom/import/deeper/import-once-test-a.less +1 -0
  204. package/test/less-bom/import/deeper/url-import.less +1 -0
  205. package/test/less-bom/import/import-and-relative-paths-test.less +17 -0
  206. package/test/less-bom/import/import-charset-test.less +1 -0
  207. package/test/less-bom/import/import-interpolation.less +2 -0
  208. package/test/less-bom/import/import-interpolation2.less +5 -0
  209. package/test/less-bom/import/import-once-test-c.less +6 -0
  210. package/test/less-bom/import/import-reference.less +89 -0
  211. package/test/less-bom/import/import-test-a.less +4 -0
  212. package/test/less-bom/import/import-test-b.less +8 -0
  213. package/test/less-bom/import/import-test-c.less +6 -0
  214. package/test/less-bom/import/import-test-d.css +1 -0
  215. package/test/less-bom/import/import-test-e.less +2 -0
  216. package/test/less-bom/import/import-test-f.less +5 -0
  217. package/test/less-bom/import/imports/font.less +8 -0
  218. package/test/less-bom/import/imports/logo.less +5 -0
  219. package/test/less-bom/import/interpolation-vars.less +6 -0
  220. package/test/less-bom/import/invalid-css.less +1 -0
  221. package/test/less-bom/import/urls.less +1 -0
  222. package/test/less-bom/import-inline.less +3 -0
  223. package/test/less-bom/import-interpolation.less +8 -0
  224. package/test/less-bom/import-once.less +6 -0
  225. package/test/less-bom/import-reference.less +23 -0
  226. package/test/less-bom/import.less +30 -0
  227. package/test/less-bom/include-path/include-path.less +6 -0
  228. package/test/less-bom/javascript.less +38 -0
  229. package/test/less-bom/lazy-eval.less +6 -0
  230. package/test/less-bom/legacy/legacy.less +7 -0
  231. package/test/less-bom/media.less +234 -0
  232. package/test/less-bom/merge.less +78 -0
  233. package/test/less-bom/mixins-args.less +215 -0
  234. package/test/less-bom/mixins-closure.less +26 -0
  235. package/test/less-bom/mixins-guards-default-func.less +195 -0
  236. package/test/less-bom/mixins-guards.less +271 -0
  237. package/test/less-bom/mixins-important.less +37 -0
  238. package/test/less-bom/mixins-interpolated.less +75 -0
  239. package/test/less-bom/mixins-named-args.less +36 -0
  240. package/test/less-bom/mixins-nested.less +22 -0
  241. package/test/less-bom/mixins-pattern.less +102 -0
  242. package/test/less-bom/mixins.less +145 -0
  243. package/test/less-bom/modifyVars/extended.json +5 -0
  244. package/test/less-bom/modifyVars/extended.less +11 -0
  245. package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
  246. package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
  247. package/test/less-bom/no-js-errors/no-js-errors.less +3 -0
  248. package/test/less-bom/no-js-errors/no-js-errors.txt +4 -0
  249. package/test/less-bom/no-output.less +2 -0
  250. package/test/less-bom/operations.less +62 -0
  251. package/test/less-bom/parens.less +45 -0
  252. package/test/less-bom/property-name-interp.less +56 -0
  253. package/test/less-bom/rulesets.less +30 -0
  254. package/test/less-bom/scope.less +104 -0
  255. package/test/less-bom/selectors.less +174 -0
  256. package/test/less-bom/sourcemaps/basic.json +3 -0
  257. package/test/less-bom/sourcemaps/basic.less +27 -0
  258. package/test/less-bom/sourcemaps/imported.css +7 -0
  259. package/test/less-bom/static-urls/urls.less +33 -0
  260. package/test/less-bom/strict-units/strict-units.less +4 -0
  261. package/test/less-bom/strings.less +73 -0
  262. package/test/less-bom/url-args/urls.less +63 -0
  263. package/test/less-bom/urls.less +94 -0
  264. package/test/less-bom/variables-in-at-rules.less +20 -0
  265. package/test/less-bom/variables.less +119 -0
  266. package/test/less-bom/whitespace.less +44 -0
  267. package/test/less-test.js +2 -2
  268. package/test/modify-vars.js +6 -4
@@ -0,0 +1,234 @@
1
+ 
2
+ // For now, variables can't be declared inside @media blocks.
3
+
4
+ @var: 42;
5
+
6
+ @media print {
7
+ .class {
8
+ color: blue;
9
+ .sub {
10
+ width: @var;
11
+ }
12
+ }
13
+ .top, header > h1 {
14
+ color: (#222 * 2);
15
+ }
16
+ }
17
+
18
+ @media screen {
19
+ @base: 8;
20
+ body { max-width: (@base * 60); }
21
+ }
22
+
23
+ @ratio_large: 16;
24
+ @ratio_small: 9;
25
+
26
+ @media all and (device-aspect-ratio: @ratio_large / @ratio_small) {
27
+ body { max-width: 800px; }
28
+ }
29
+
30
+ @media all and (orientation:portrait) {
31
+ aside { float: none; }
32
+ }
33
+
34
+ @media handheld and (min-width: @var), screen and (min-width: 20em) {
35
+ body {
36
+ max-width: 480px;
37
+ }
38
+ }
39
+
40
+ body {
41
+ @media print {
42
+ padding: 20px;
43
+
44
+ header {
45
+ background-color: red;
46
+ }
47
+
48
+ @media (orientation:landscape) {
49
+ margin-left: 20px;
50
+ }
51
+ }
52
+ }
53
+
54
+ @media screen {
55
+ .sidebar {
56
+ width: 300px;
57
+ @media (orientation: landscape) {
58
+ width: 500px;
59
+ }
60
+ }
61
+ }
62
+
63
+ @media a {
64
+ .first {
65
+ @media b {
66
+ .second {
67
+ .third {
68
+ width: 300px;
69
+ @media c {
70
+ width: 500px;
71
+ }
72
+ }
73
+ .fourth {
74
+ width: 3;
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+
81
+ body {
82
+ @media a, b and c {
83
+ width: 95%;
84
+
85
+ @media x, y {
86
+ width: 100%;
87
+ }
88
+ }
89
+ }
90
+
91
+ .mediaMixin(@fallback: 200px) {
92
+ background: black;
93
+
94
+ @media handheld {
95
+ background: white;
96
+
97
+ @media (max-width: @fallback) {
98
+ background: red;
99
+ }
100
+ }
101
+ }
102
+
103
+ .a {
104
+ .mediaMixin(100px);
105
+ }
106
+
107
+ .b {
108
+ .mediaMixin();
109
+ }
110
+ @smartphone: ~"only screen and (max-width: 200px)";
111
+ @media @smartphone {
112
+ body {
113
+ width: 480px;
114
+ }
115
+ }
116
+
117
+ @media print {
118
+ @page :left {
119
+ margin: 0.5cm;
120
+ }
121
+ @page :right {
122
+ margin: 0.5cm;
123
+ }
124
+ @page Test:first {
125
+ margin: 1cm;
126
+ }
127
+ @page :first {
128
+ size: 8.5in 11in;
129
+ @top-left {
130
+ margin: 1cm;
131
+ }
132
+ @top-left-corner {
133
+ margin: 1cm;
134
+ }
135
+ @top-center {
136
+ margin: 1cm;
137
+ }
138
+ @top-right {
139
+ margin: 1cm;
140
+ }
141
+ @top-right-corner {
142
+ margin: 1cm;
143
+ }
144
+ @bottom-left {
145
+ margin: 1cm;
146
+ }
147
+ @bottom-left-corner {
148
+ margin: 1cm;
149
+ }
150
+ @bottom-center {
151
+ margin: 1cm;
152
+ }
153
+ @bottom-right {
154
+ margin: 1cm;
155
+ }
156
+ @bottom-right-corner {
157
+ margin: 1cm;
158
+ }
159
+ @left-top {
160
+ margin: 1cm;
161
+ }
162
+ @left-middle {
163
+ margin: 1cm;
164
+ }
165
+ @left-bottom {
166
+ margin: 1cm;
167
+ }
168
+ @right-top {
169
+ margin: 1cm;
170
+ }
171
+ @right-middle {
172
+ content: "Page " counter(page);
173
+ }
174
+ @right-bottom {
175
+ margin: 1cm;
176
+ }
177
+ }
178
+ }
179
+
180
+ @media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-resolution: 2dppx), (min-resolution: 128dpcm) {
181
+ .b {
182
+ background: red;
183
+ }
184
+ }
185
+
186
+ .bg() {
187
+ background: red;
188
+
189
+ @media (max-width: 500px) {
190
+ background: green;
191
+ }
192
+ }
193
+
194
+ body {
195
+ .bg();
196
+ }
197
+
198
+ @bpMedium: 1000px;
199
+ @media (max-width: @bpMedium) {
200
+ body {
201
+ .bg();
202
+ background: blue;
203
+ }
204
+ }
205
+
206
+ @media (max-width: 1200px) {
207
+ /* a comment */
208
+
209
+ @media (max-width: 900px) {
210
+ body { font-size: 11px; }
211
+ }
212
+ }
213
+
214
+ .nav-justified {
215
+ @media (min-width: 480px) {
216
+ > li {
217
+ display: table-cell;
218
+ }
219
+ }
220
+ }
221
+
222
+ .menu
223
+ {
224
+ @media (min-width: 768px) {
225
+ .nav-justified();
226
+ }
227
+ }
228
+ @all: ~"all";
229
+ @tv: ~"tv";
230
+ @media @all and @tv {
231
+ .all-and-tv-variables {
232
+ var: all-and-tv;
233
+ }
234
+ }
@@ -0,0 +1,78 @@
1
+ .first-transform() {
2
+ transform+: rotate(90deg), skew(30deg);
3
+ }
4
+ .second-transform() {
5
+ transform+: scale(2,4);
6
+ }
7
+ .third-transform() {
8
+ transform: scaleX(45deg);
9
+ }
10
+ .fourth-transform() {
11
+ transform+: scaleX(45deg);
12
+ }
13
+ .fifth-transform() {
14
+ transform+: scale(2,4) !important;
15
+ }
16
+ .first-background() {
17
+ background+: url(data://img1.png);
18
+ }
19
+ .second-background() {
20
+ background+: url(data://img2.png);
21
+ }
22
+
23
+ .test1 {
24
+ // Can merge values
25
+ .first-transform();
26
+ .second-transform();
27
+ }
28
+ .test2 {
29
+ // Wont merge values without +: merge directive, for backwards compatibility with css
30
+ .first-transform();
31
+ .third-transform();
32
+ }
33
+ .test3 {
34
+ // Wont merge values from two sources with different properties
35
+ .fourth-transform();
36
+ .first-background();
37
+ }
38
+ .test4 {
39
+ // Wont merge values from sources that merked as !important, for backwards compatibility with css
40
+ .first-transform();
41
+ .fifth-transform();
42
+ }
43
+ .test5 {
44
+ // Wont merge values from mixins that merked as !important, for backwards compatibility with css
45
+ .first-transform();
46
+ .second-transform() !important;
47
+ }
48
+ .test6 {
49
+ // Ignores !merge if no peers found
50
+ .second-transform();
51
+ }
52
+
53
+ .test-interleaved {
54
+ transform+: t1;
55
+ background+: b1;
56
+ transform+: t2;
57
+ background+: b2, b3;
58
+ transform+: t3;
59
+ }
60
+
61
+ .test-spaced {
62
+ transform+_: t1;
63
+ background+_: b1;
64
+ transform+_: t2;
65
+ background+_: b2, b3;
66
+ transform+_: t3;
67
+ }
68
+
69
+ .test-interleaved-with-spaced {
70
+ transform+_: t1s;
71
+ transform+: t2;
72
+ background+: b1;
73
+ transform+_: t3s;
74
+ transform+: t4 t5s;
75
+ background+_: b2s, b3;
76
+ transform+_: t6s;
77
+ background+: b4;
78
+ }
@@ -0,0 +1,215 @@
1
+ .mixin (@a: 1px, @b: 50%) {
2
+ width: (@a * 5);
3
+ height: (@b - 1%);
4
+ }
5
+
6
+ .mixina (@style, @width, @color: black) {
7
+ border: @width @style @color;
8
+ }
9
+
10
+ .mixiny
11
+ (@a: 0, @b: 0) {
12
+ margin: @a;
13
+ padding: @b;
14
+ }
15
+
16
+ .hidden() {
17
+ color: transparent; // asd
18
+ }
19
+
20
+ #hidden {
21
+ .hidden;
22
+ }
23
+
24
+ #hidden1 {
25
+ .hidden();
26
+ }
27
+
28
+ .two-args {
29
+ color: blue;
30
+ .mixin(2px, 100%);
31
+ .mixina(dotted, 2px);
32
+ }
33
+
34
+ .one-arg {
35
+ .mixin(3px);
36
+ }
37
+
38
+ .no-parens {
39
+ .mixin;
40
+ }
41
+
42
+ .no-args {
43
+ .mixin();
44
+ }
45
+
46
+ .var-args {
47
+ @var: 9;
48
+ .mixin(@var, (@var * 2));
49
+ }
50
+
51
+ .multi-mix {
52
+ .mixin(2px, 30%);
53
+ .mixiny(4, 5);
54
+ }
55
+
56
+ .maxa(@arg1: 10, @arg2: #f00) {
57
+ padding: (@arg1 * 2px);
58
+ color: @arg2;
59
+ }
60
+
61
+ body {
62
+ .maxa(15);
63
+ }
64
+
65
+ @glob: 5;
66
+ .global-mixin(@a:2) {
67
+ width: (@glob + @a);
68
+ }
69
+
70
+ .scope-mix {
71
+ .global-mixin(3);
72
+ }
73
+
74
+ .nested-ruleset (@width: 200px) {
75
+ width: @width;
76
+ .column { margin: @width; }
77
+ }
78
+ .content {
79
+ .nested-ruleset(600px);
80
+ }
81
+
82
+ //
83
+
84
+ .same-var-name2(@radius) {
85
+ radius: @radius;
86
+ }
87
+ .same-var-name(@radius) {
88
+ .same-var-name2(@radius);
89
+ }
90
+ #same-var-name {
91
+ .same-var-name(5px);
92
+ }
93
+
94
+ //
95
+
96
+ .var-inside () {
97
+ @var: 10px;
98
+ width: @var;
99
+ }
100
+ #var-inside { .var-inside; }
101
+
102
+ .mixin-arguments (@width: 0px, ...) {
103
+ border: @arguments;
104
+ width: @width;
105
+ }
106
+
107
+ .arguments {
108
+ .mixin-arguments(1px, solid, black);
109
+ }
110
+ .arguments2 {
111
+ .mixin-arguments();
112
+ }
113
+ .arguments3 {
114
+ .mixin-arguments;
115
+ }
116
+
117
+ .mixin-arguments2 (@width, @rest...) {
118
+ border: @arguments;
119
+ rest: @rest;
120
+ width: @width;
121
+ }
122
+ .arguments4 {
123
+ .mixin-arguments2(0, 1, 2, 3, 4);
124
+ }
125
+
126
+ // Edge cases
127
+
128
+ .edge-case {
129
+ .mixin-arguments("{");
130
+ }
131
+
132
+ // Division vs. Literal Slash
133
+ .border-radius(@r: 2px/5px) {
134
+ border-radius: @r;
135
+ }
136
+ .slash-vs-math {
137
+ .border-radius();
138
+ .border-radius(5px/10px);
139
+ .border-radius((3px * 2));
140
+ }
141
+ // semi-colon vs comma for delimiting
142
+
143
+ .mixin-takes-one(@a) {
144
+ one: @a;
145
+ }
146
+
147
+ .mixin-takes-two(@a; @b) {
148
+ one: @a;
149
+ two: @b;
150
+ }
151
+
152
+ .comma-vs-semi-colon {
153
+ .mixin-takes-two(@a : a; @b : b, c);
154
+ .mixin-takes-two(@a : d, e; @b : f);
155
+ .mixin-takes-one(@a: g);
156
+ .mixin-takes-one(@a : h;);
157
+ .mixin-takes-one(i);
158
+ .mixin-takes-one(j;);
159
+ .mixin-takes-two(k, l);
160
+ .mixin-takes-one(m, n;);
161
+ .mixin-takes-two(o, p; q);
162
+ .mixin-takes-two(r, s; t;);
163
+ }
164
+
165
+ .mixin-conflict(@a:defA, @b:defB, @c:defC) {
166
+ three: @a, @b, @c;
167
+ }
168
+
169
+ .mixin-conflict(@a:defA, @b:defB, @c:defC, @d:defD) {
170
+ four: @a, @b, @c, @d;
171
+ }
172
+
173
+ #named-conflict {
174
+ .mixin-conflict(11, 12, 13, @a:a);
175
+ .mixin-conflict(@a:a, 21, 22, 23);
176
+ }
177
+ @a: 3px;
178
+ .mixin-default-arg(@a: 1px, @b: @a, @c: @b) {
179
+ defaults: 1px 1px 1px;
180
+ defaults: 2px 2px 2px;
181
+ }
182
+
183
+ .test-mixin-default-arg {
184
+ .mixin-default-arg();
185
+ .mixin-default-arg(2px);
186
+ }
187
+
188
+ .mixin-comma-default1(@color; @padding; @margin: 2, 2, 2, 2) {
189
+ margin: @margin;
190
+ }
191
+ .selector {
192
+ .mixin-comma-default1(#33acfe; 4);
193
+ }
194
+ .mixin-comma-default2(@margin: 2, 2, 2, 2;) {
195
+ margin: @margin;
196
+ }
197
+ .selector2 {
198
+ .mixin-comma-default2();
199
+ }
200
+ .mixin-comma-default3(@margin: 2, 2, 2, 2) {
201
+ margin: @margin;
202
+ }
203
+ .selector3 {
204
+ .mixin-comma-default3(4,2,2,2);
205
+ }
206
+
207
+ .test-calling-one-arg-mixin(@a) {
208
+ }
209
+
210
+ .test-calling-one-arg-mixin(@a, @b, @rest...) {
211
+ }
212
+
213
+ div {
214
+ .test-calling-one-arg-mixin(1);
215
+ }
@@ -0,0 +1,26 @@
1
+ .scope {
2
+ @var: 99px;
3
+ .mixin () {
4
+ width: @var;
5
+ }
6
+ }
7
+
8
+ .class {
9
+ .scope > .mixin;
10
+ }
11
+
12
+ .overwrite {
13
+ @var: 0px;
14
+ .scope > .mixin;
15
+ }
16
+
17
+ .nested {
18
+ @var: 5px;
19
+ .mixin () {
20
+ width: @var;
21
+ }
22
+ .class {
23
+ @var: 10px;
24
+ .mixin;
25
+ }
26
+ }