less 2.3.1 → 2.4.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 (301) hide show
  1. package/.idea/workspace.xml +277 -237
  2. package/.jscsrc +36 -1
  3. package/.travis.yml +1 -0
  4. package/CHANGELOG.md +14 -0
  5. package/Gruntfile.js +1 -1
  6. package/appveyor.yml +5 -0
  7. package/bin/lessc +8 -5
  8. package/bower.json +1 -1
  9. package/dist/less.js +909 -814
  10. package/dist/less.min.js +6 -6
  11. package/lib/less/contexts.js +2 -2
  12. package/lib/less/environment/abstract-file-manager.js +6 -6
  13. package/lib/less/environment/environment.js +2 -2
  14. package/lib/less/functions/color.js +13 -5
  15. package/lib/less/functions/math.js +1 -1
  16. package/lib/less/functions/number.js +2 -2
  17. package/lib/less/functions/types.js +18 -8
  18. package/lib/less/import-manager.js +5 -5
  19. package/lib/less/index.js +1 -1
  20. package/lib/less/less-error.js +1 -1
  21. package/lib/less/logger.js +2 -2
  22. package/lib/less/parse-tree.js +45 -45
  23. package/lib/less/parse.js +5 -2
  24. package/lib/less/parser/parser-input.js +3 -3
  25. package/lib/less/parser/parser.js +52 -18
  26. package/lib/less/plugin-manager.js +30 -3
  27. package/lib/less/render.js +5 -2
  28. package/lib/less/source-map-builder.js +4 -0
  29. package/lib/less/source-map-output.js +3 -3
  30. package/lib/less/transform-tree.js +4 -4
  31. package/lib/less/tree/anonymous.js +1 -1
  32. package/lib/less/tree/call.js +1 -1
  33. package/lib/less/tree/color.js +2 -2
  34. package/lib/less/tree/condition.js +8 -4
  35. package/lib/less/tree/dimension.js +4 -4
  36. package/lib/less/tree/element.js +1 -1
  37. package/lib/less/tree/expression.js +1 -1
  38. package/lib/less/tree/extend.js +3 -3
  39. package/lib/less/tree/javascript.js +2 -2
  40. package/lib/less/tree/media.js +20 -20
  41. package/lib/less/tree/mixin-call.js +2 -2
  42. package/lib/less/tree/mixin-definition.js +29 -8
  43. package/lib/less/tree/quoted.js +3 -3
  44. package/lib/less/tree/rule.js +1 -1
  45. package/lib/less/tree/ruleset.js +35 -28
  46. package/lib/less/tree/selector.js +1 -1
  47. package/lib/less/tree/unit.js +2 -0
  48. package/lib/less/tree/value.js +1 -1
  49. package/lib/less/visitors/extend-visitor.js +15 -14
  50. package/lib/less/visitors/import-sequencer.js +2 -2
  51. package/lib/less/visitors/import-visitor.js +2 -2
  52. package/lib/less/visitors/to-css-visitor.js +5 -5
  53. package/lib/less-browser/cache.js +2 -2
  54. package/lib/less-browser/file-manager.js +96 -96
  55. package/lib/less-browser/index.js +205 -205
  56. package/lib/less-browser/log-listener.js +2 -2
  57. package/lib/less-browser/utils.js +6 -6
  58. package/lib/less-node/file-manager.js +9 -4
  59. package/lib/less-node/index.js +3 -3
  60. package/lib/less-node/plugin-loader.js +3 -3
  61. package/lib/less-node/url-file-manager.js +5 -2
  62. package/lib/less-rhino/index.js +13 -9
  63. package/lib/source-map/source-map-0.1.31.js +1 -1
  64. package/package.json +1 -1
  65. package/test/browser/css/relative-urls/urls.css +1 -0
  66. package/test/browser/less/relative-urls/urls.less +1 -0
  67. package/test/browser/runner-browser-options.js +23 -23
  68. package/test/browser/runner-errors-spec.js +1 -1
  69. package/test/browser/runner-global-vars-spec.js +1 -1
  70. package/test/browser/runner-main-options.js +5 -5
  71. package/test/browser/runner-main-spec.js +1 -1
  72. package/test/copy-bom.js +35 -35
  73. package/test/css/functions.css +8 -0
  74. package/test/css/import-interpolation.css +1 -0
  75. package/test/css/mixins-important.css +6 -0
  76. package/test/css/selectors.css +5 -0
  77. package/test/css/static-urls/urls.css +1 -0
  78. package/test/css/urls.css +1 -0
  79. package/test/index.js +2 -1
  80. package/test/less/functions.less +13 -0
  81. package/test/less/import/imports/logo.less +1 -0
  82. package/test/less/mixins-important.less +17 -1
  83. package/test/less/selectors.less +10 -0
  84. package/test/less/sourcemaps-empty/empty.less +0 -0
  85. package/test/less/sourcemaps-empty/var-defs.less +1 -0
  86. package/test/less/urls.less +1 -1
  87. package/test/less-test.js +49 -27
  88. package/test/modify-vars.js +13 -13
  89. package/test/browser/less.js +0 -29
  90. package/test/less-bom/charsets.less +0 -3
  91. package/test/less-bom/colors.less +0 -98
  92. package/test/less-bom/comments.less +0 -102
  93. package/test/less-bom/comments2.less +0 -20
  94. package/test/less-bom/compression/compression.less +0 -36
  95. package/test/less-bom/css-3.less +0 -154
  96. package/test/less-bom/css-escapes.less +0 -33
  97. package/test/less-bom/css-guards.less +0 -103
  98. package/test/less-bom/css.less +0 -108
  99. package/test/less-bom/debug/import/test.less +0 -25
  100. package/test/less-bom/debug/linenumbers.less +0 -33
  101. package/test/less-bom/detached-rulesets.less +0 -103
  102. package/test/less-bom/empty.less +0 -1
  103. package/test/less-bom/errors/add-mixed-units.less +0 -3
  104. package/test/less-bom/errors/add-mixed-units.txt +0 -4
  105. package/test/less-bom/errors/add-mixed-units2.less +0 -3
  106. package/test/less-bom/errors/add-mixed-units2.txt +0 -4
  107. package/test/less-bom/errors/at-rules-undefined-var.less +0 -4
  108. package/test/less-bom/errors/at-rules-undefined-var.txt +0 -4
  109. package/test/less-bom/errors/bad-variable-declaration1.less +0 -1
  110. package/test/less-bom/errors/bad-variable-declaration1.txt +0 -2
  111. package/test/less-bom/errors/color-func-invalid-color.less +0 -3
  112. package/test/less-bom/errors/color-func-invalid-color.txt +0 -4
  113. package/test/less-bom/errors/color-invalid-hex-code.less +0 -3
  114. package/test/less-bom/errors/color-invalid-hex-code.txt +0 -4
  115. package/test/less-bom/errors/color-invalid-hex-code2.less +0 -3
  116. package/test/less-bom/errors/color-invalid-hex-code2.txt +0 -4
  117. package/test/less-bom/errors/css-guard-default-func.less +0 -4
  118. package/test/less-bom/errors/css-guard-default-func.txt +0 -4
  119. package/test/less-bom/errors/detached-ruleset-1.less +0 -6
  120. package/test/less-bom/errors/detached-ruleset-1.txt +0 -4
  121. package/test/less-bom/errors/detached-ruleset-2.less +0 -6
  122. package/test/less-bom/errors/detached-ruleset-2.txt +0 -4
  123. package/test/less-bom/errors/detached-ruleset-3.less +0 -4
  124. package/test/less-bom/errors/detached-ruleset-3.txt +0 -4
  125. package/test/less-bom/errors/detached-ruleset-4.less +0 -5
  126. package/test/less-bom/errors/detached-ruleset-4.txt +0 -4
  127. package/test/less-bom/errors/detached-ruleset-5.less +0 -4
  128. package/test/less-bom/errors/detached-ruleset-5.txt +0 -3
  129. package/test/less-bom/errors/detached-ruleset-6.less +0 -5
  130. package/test/less-bom/errors/detached-ruleset-6.txt +0 -4
  131. package/test/less-bom/errors/divide-mixed-units.less +0 -3
  132. package/test/less-bom/errors/divide-mixed-units.txt +0 -4
  133. package/test/less-bom/errors/extend-no-selector.less +0 -3
  134. package/test/less-bom/errors/extend-no-selector.txt +0 -3
  135. package/test/less-bom/errors/extend-not-at-end.less +0 -3
  136. package/test/less-bom/errors/extend-not-at-end.txt +0 -3
  137. package/test/less-bom/errors/import-malformed.less +0 -1
  138. package/test/less-bom/errors/import-malformed.txt +0 -3
  139. package/test/less-bom/errors/import-missing.less +0 -6
  140. package/test/less-bom/errors/import-missing.txt +0 -3
  141. package/test/less-bom/errors/import-no-semi.less +0 -1
  142. package/test/less-bom/errors/import-no-semi.txt +0 -2
  143. package/test/less-bom/errors/import-subfolder1.less +0 -1
  144. package/test/less-bom/errors/import-subfolder1.txt +0 -3
  145. package/test/less-bom/errors/import-subfolder2.less +0 -1
  146. package/test/less-bom/errors/import-subfolder2.txt +0 -4
  147. package/test/less-bom/errors/imports/import-subfolder1.less +0 -1
  148. package/test/less-bom/errors/imports/import-subfolder2.less +0 -1
  149. package/test/less-bom/errors/imports/import-test.less +0 -4
  150. package/test/less-bom/errors/imports/subfolder/mixin-not-defined.less +0 -1
  151. package/test/less-bom/errors/imports/subfolder/parse-error-curly-bracket.less +0 -1
  152. package/test/less-bom/errors/javascript-error.less +0 -3
  153. package/test/less-bom/errors/javascript-error.txt +0 -4
  154. package/test/less-bom/errors/javascript-undefined-var.less +0 -3
  155. package/test/less-bom/errors/javascript-undefined-var.txt +0 -4
  156. package/test/less-bom/errors/mixed-mixin-definition-args-1.less +0 -6
  157. package/test/less-bom/errors/mixed-mixin-definition-args-1.txt +0 -4
  158. package/test/less-bom/errors/mixed-mixin-definition-args-2.less +0 -6
  159. package/test/less-bom/errors/mixed-mixin-definition-args-2.txt +0 -4
  160. package/test/less-bom/errors/mixin-not-defined.less +0 -11
  161. package/test/less-bom/errors/mixin-not-defined.txt +0 -3
  162. package/test/less-bom/errors/mixin-not-matched.less +0 -6
  163. package/test/less-bom/errors/mixin-not-matched.txt +0 -3
  164. package/test/less-bom/errors/mixin-not-matched2.less +0 -6
  165. package/test/less-bom/errors/mixin-not-matched2.txt +0 -3
  166. package/test/less-bom/errors/mixin-not-visible-in-scope-1.less +0 -9
  167. package/test/less-bom/errors/mixin-not-visible-in-scope-1.txt +0 -4
  168. package/test/less-bom/errors/mixins-guards-default-func-1.less +0 -9
  169. package/test/less-bom/errors/mixins-guards-default-func-1.txt +0 -4
  170. package/test/less-bom/errors/mixins-guards-default-func-2.less +0 -9
  171. package/test/less-bom/errors/mixins-guards-default-func-2.txt +0 -4
  172. package/test/less-bom/errors/mixins-guards-default-func-3.less +0 -9
  173. package/test/less-bom/errors/mixins-guards-default-func-3.txt +0 -4
  174. package/test/less-bom/errors/multiple-guards-on-css-selectors.less +0 -4
  175. package/test/less-bom/errors/multiple-guards-on-css-selectors.txt +0 -4
  176. package/test/less-bom/errors/multiple-guards-on-css-selectors2.less +0 -4
  177. package/test/less-bom/errors/multiple-guards-on-css-selectors2.txt +0 -4
  178. package/test/less-bom/errors/multiply-mixed-units.less +0 -7
  179. package/test/less-bom/errors/multiply-mixed-units.txt +0 -4
  180. package/test/less-bom/errors/parens-error-1.less +0 -3
  181. package/test/less-bom/errors/parens-error-1.txt +0 -4
  182. package/test/less-bom/errors/parens-error-2.less +0 -3
  183. package/test/less-bom/errors/parens-error-2.txt +0 -4
  184. package/test/less-bom/errors/parens-error-3.less +0 -3
  185. package/test/less-bom/errors/parens-error-3.txt +0 -4
  186. package/test/less-bom/errors/parse-error-curly-bracket.less +0 -4
  187. package/test/less-bom/errors/parse-error-curly-bracket.txt +0 -4
  188. package/test/less-bom/errors/parse-error-extra-parens.less +0 -5
  189. package/test/less-bom/errors/parse-error-extra-parens.txt +0 -3
  190. package/test/less-bom/errors/parse-error-missing-bracket.less +0 -2
  191. package/test/less-bom/errors/parse-error-missing-bracket.txt +0 -3
  192. package/test/less-bom/errors/parse-error-missing-parens.less +0 -5
  193. package/test/less-bom/errors/parse-error-missing-parens.txt +0 -3
  194. package/test/less-bom/errors/parse-error-with-import.less +0 -13
  195. package/test/less-bom/errors/parse-error-with-import.txt +0 -4
  196. package/test/less-bom/errors/percentage-missing-space.less +0 -3
  197. package/test/less-bom/errors/percentage-missing-space.txt +0 -4
  198. package/test/less-bom/errors/property-asterisk-only-name.less +0 -3
  199. package/test/less-bom/errors/property-asterisk-only-name.txt +0 -4
  200. package/test/less-bom/errors/property-ie5-hack.less +0 -3
  201. package/test/less-bom/errors/property-ie5-hack.txt +0 -3
  202. package/test/less-bom/errors/property-in-root.less +0 -4
  203. package/test/less-bom/errors/property-in-root.txt +0 -4
  204. package/test/less-bom/errors/property-in-root2.less +0 -1
  205. package/test/less-bom/errors/property-in-root2.txt +0 -4
  206. package/test/less-bom/errors/property-in-root3.less +0 -4
  207. package/test/less-bom/errors/property-in-root3.txt +0 -3
  208. package/test/less-bom/errors/property-interp-not-defined.less +0 -1
  209. package/test/less-bom/errors/property-interp-not-defined.txt +0 -2
  210. package/test/less-bom/errors/recursive-variable.less +0 -1
  211. package/test/less-bom/errors/recursive-variable.txt +0 -2
  212. package/test/less-bom/errors/single-character.less +0 -1
  213. package/test/less-bom/errors/single-character.txt +0 -2
  214. package/test/less-bom/errors/svg-gradient1.less +0 -3
  215. package/test/less-bom/errors/svg-gradient1.txt +0 -4
  216. package/test/less-bom/errors/svg-gradient2.less +0 -3
  217. package/test/less-bom/errors/svg-gradient2.txt +0 -4
  218. package/test/less-bom/errors/svg-gradient3.less +0 -3
  219. package/test/less-bom/errors/svg-gradient3.txt +0 -4
  220. package/test/less-bom/errors/unit-function.less +0 -3
  221. package/test/less-bom/errors/unit-function.txt +0 -4
  222. package/test/less-bom/extend-chaining.less +0 -91
  223. package/test/less-bom/extend-clearfix.less +0 -19
  224. package/test/less-bom/extend-exact.less +0 -46
  225. package/test/less-bom/extend-media.less +0 -24
  226. package/test/less-bom/extend-nest.less +0 -65
  227. package/test/less-bom/extend-selector.less +0 -99
  228. package/test/less-bom/extend.less +0 -81
  229. package/test/less-bom/extract-and-length.less +0 -133
  230. package/test/less-bom/functions.less +0 -201
  231. package/test/less-bom/globalVars/extended.json +0 -5
  232. package/test/less-bom/globalVars/extended.less +0 -10
  233. package/test/less-bom/globalVars/simple.json +0 -3
  234. package/test/less-bom/globalVars/simple.less +0 -3
  235. package/test/less-bom/ie-filters.less +0 -15
  236. package/test/less-bom/import/deeper/deeper-2/url-import-2.less +0 -3
  237. package/test/less-bom/import/deeper/deeper-2/url-import.less +0 -1
  238. package/test/less-bom/import/deeper/import-once-test-a.less +0 -1
  239. package/test/less-bom/import/deeper/url-import.less +0 -1
  240. package/test/less-bom/import/import-and-relative-paths-test.less +0 -17
  241. package/test/less-bom/import/import-charset-test.less +0 -1
  242. package/test/less-bom/import/import-interpolation.less +0 -2
  243. package/test/less-bom/import/import-interpolation2.less +0 -5
  244. package/test/less-bom/import/import-once-test-c.less +0 -6
  245. package/test/less-bom/import/import-reference.less +0 -89
  246. package/test/less-bom/import/import-test-a.less +0 -4
  247. package/test/less-bom/import/import-test-b.less +0 -8
  248. package/test/less-bom/import/import-test-c.less +0 -6
  249. package/test/less-bom/import/import-test-d.css +0 -1
  250. package/test/less-bom/import/import-test-e.less +0 -2
  251. package/test/less-bom/import/import-test-f.less +0 -5
  252. package/test/less-bom/import/imports/font.less +0 -8
  253. package/test/less-bom/import/imports/logo.less +0 -5
  254. package/test/less-bom/import/interpolation-vars.less +0 -6
  255. package/test/less-bom/import/invalid-css.less +0 -1
  256. package/test/less-bom/import/urls.less +0 -1
  257. package/test/less-bom/import-inline.less +0 -3
  258. package/test/less-bom/import-interpolation.less +0 -8
  259. package/test/less-bom/import-once.less +0 -6
  260. package/test/less-bom/import-reference.less +0 -23
  261. package/test/less-bom/import.less +0 -30
  262. package/test/less-bom/include-path/include-path.less +0 -6
  263. package/test/less-bom/javascript.less +0 -38
  264. package/test/less-bom/lazy-eval.less +0 -6
  265. package/test/less-bom/legacy/legacy.less +0 -7
  266. package/test/less-bom/media.less +0 -234
  267. package/test/less-bom/merge.less +0 -78
  268. package/test/less-bom/mixins-args.less +0 -215
  269. package/test/less-bom/mixins-closure.less +0 -26
  270. package/test/less-bom/mixins-guards-default-func.less +0 -195
  271. package/test/less-bom/mixins-guards.less +0 -271
  272. package/test/less-bom/mixins-important.less +0 -37
  273. package/test/less-bom/mixins-interpolated.less +0 -75
  274. package/test/less-bom/mixins-named-args.less +0 -36
  275. package/test/less-bom/mixins-nested.less +0 -22
  276. package/test/less-bom/mixins-pattern.less +0 -102
  277. package/test/less-bom/mixins.less +0 -145
  278. package/test/less-bom/modifyVars/extended.json +0 -5
  279. package/test/less-bom/modifyVars/extended.less +0 -11
  280. package/test/less-bom/nested-gradient-with-svg-gradient/mixin-consumer.less +0 -5
  281. package/test/less-bom/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +0 -15
  282. package/test/less-bom/no-js-errors/no-js-errors.less +0 -3
  283. package/test/less-bom/no-js-errors/no-js-errors.txt +0 -4
  284. package/test/less-bom/no-output.less +0 -2
  285. package/test/less-bom/operations.less +0 -62
  286. package/test/less-bom/parens.less +0 -45
  287. package/test/less-bom/property-name-interp.less +0 -56
  288. package/test/less-bom/rulesets.less +0 -30
  289. package/test/less-bom/scope.less +0 -104
  290. package/test/less-bom/selectors.less +0 -174
  291. package/test/less-bom/sourcemaps/basic.json +0 -3
  292. package/test/less-bom/sourcemaps/basic.less +0 -27
  293. package/test/less-bom/sourcemaps/imported.css +0 -7
  294. package/test/less-bom/static-urls/urls.less +0 -33
  295. package/test/less-bom/strict-units/strict-units.less +0 -4
  296. package/test/less-bom/strings.less +0 -73
  297. package/test/less-bom/url-args/urls.less +0 -63
  298. package/test/less-bom/urls.less +0 -94
  299. package/test/less-bom/variables-in-at-rules.less +0 -20
  300. package/test/less-bom/variables.less +0 -119
  301. package/test/less-bom/whitespace.less +0 -44
@@ -18,11 +18,11 @@ function formatError(ctx, options) {
18
18
  return ctx.stack || ctx.message;
19
19
  }
20
20
 
21
- if (typeof(extract[0]) === 'string') {
21
+ if (typeof extract[0] === 'string') {
22
22
  error.push(stylize((ctx.line - 1) + ' ' + extract[0], 'grey'));
23
23
  }
24
24
 
25
- if (typeof(extract[1]) === 'string') {
25
+ if (typeof extract[1] === 'string') {
26
26
  var errorTxt = ctx.line + ' ';
27
27
  if (extract[1]) {
28
28
  errorTxt += extract[1].slice(0, ctx.column) +
@@ -32,14 +32,14 @@ function formatError(ctx, options) {
32
32
  error.push(errorTxt);
33
33
  }
34
34
 
35
- if (typeof(extract[2]) === 'string') {
35
+ if (typeof extract[2] === 'string') {
36
36
  error.push(stylize((ctx.line + 1) + ' ' + extract[2], 'grey'));
37
37
  }
38
38
  error = error.join('\n') + stylize('', 'reset') + '\n';
39
39
 
40
40
  message += stylize(ctx.type + 'Error: ' + ctx.message, 'red');
41
41
  if (ctx.filename) {
42
- message += stylize(' in ', 'red') + ctx.filename +
42
+ message += stylize(' in ', 'red') + ctx.filename +
43
43
  stylize(' on line ' + ctx.line + ', column ' + (ctx.column + 1) + ':', 'grey');
44
44
  }
45
45
 
@@ -113,7 +113,7 @@ less.Parser.fileLoader = function (file, currentFileInfo, callback, env) {
113
113
  }
114
114
 
115
115
  var j = file.lastIndexOf('/');
116
- if(newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
116
+ if (newFileInfo.relativeUrls && !/^(?:[a-z-]+:|\/)/.test(file) && j != -1) {
117
117
  var relativeSubDirectory = file.slice(0, j + 1);
118
118
  newFileInfo.rootpath = newFileInfo.rootpath + relativeSubDirectory; // append (sub|sup) directory path of imported file
119
119
  }
@@ -196,8 +196,12 @@ function writeFile(filename, content) {
196
196
  }
197
197
 
198
198
  match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i);
199
- if (match) { arg = match[1]; } // was (?:=([^\s]*)), check!
200
- else { return arg; }
199
+ if (match) {
200
+ arg = match[1];
201
+ }
202
+ else {
203
+ return arg;
204
+ }
201
205
 
202
206
  switch (arg) {
203
207
  case 'v':
@@ -305,10 +309,10 @@ function writeFile(filename, content) {
305
309
  case 'source-map-output-map-file':
306
310
  if (checkArgFunc(arg, match[2])) {
307
311
  options.writeSourceMap = function(sourceMapContent) {
308
- writeFile(match[2], sourceMapContent);
312
+ writeFile(match[2], sourceMapContent);
309
313
  };
310
314
  }
311
- break;
315
+ break;
312
316
  case 'rp':
313
317
  case 'rootpath':
314
318
  if (checkArgFunc(arg, match[2])) {
@@ -1872,7 +1872,7 @@ define('source-map/source-node', ['require', 'exports', 'module' , 'source-map/
1872
1872
  if (original.source !== null
1873
1873
  && original.line !== null
1874
1874
  && original.column !== null) {
1875
- if(lastOriginalSource !== original.source
1875
+ if (lastOriginalSource !== original.source
1876
1876
  || lastOriginalLine !== original.line
1877
1877
  || lastOriginalColumn !== original.column
1878
1878
  || lastOriginalName !== original.name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "less",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Leaner CSS",
5
5
  "homepage": "http://lesscss.org",
6
6
  "author": {
@@ -15,6 +15,7 @@
15
15
  }
16
16
  #misc {
17
17
  background-image: url(http://localhost:8081/test/browser/less/relative-urls/images/image.jpg);
18
+ background: url("#inline-svg");
18
19
  }
19
20
  #data-uri {
20
21
  background: url(data:image/png;charset=utf-8;base64,
@@ -10,6 +10,7 @@
10
10
  }
11
11
  #misc {
12
12
  background-image: url(images/image.jpg);
13
+ background: url("#inline-svg");
13
14
  }
14
15
  #data-uri {
15
16
  background: url(data:image/png;charset=utf-8;base64,
@@ -18,34 +18,34 @@ if (window.navigator.userAgent.indexOf("MSIE") >= 0) {
18
18
  // setup style tags with less and link tags pointing to expected css output
19
19
 
20
20
  for (var i = 0; i < testFiles.length; i++) {
21
- var file = testFiles[i],
22
- lessPath = '/test/less/' + file + '.less',
23
- cssPath = '/test/css/' + file + '.css',
24
- lessStyle = document.createElement('style'),
25
- cssLink = document.createElement('link'),
26
- lessText = '@import "' + lessPath + '";';
21
+ var file = testFiles[i],
22
+ lessPath = '/test/less/' + file + '.less',
23
+ cssPath = '/test/css/' + file + '.css',
24
+ lessStyle = document.createElement('style'),
25
+ cssLink = document.createElement('link'),
26
+ lessText = '@import "' + lessPath + '";';
27
27
 
28
- lessStyle.type = 'text/less';
29
- lessStyle.id = file;
30
- lessStyle.href = file;
28
+ lessStyle.type = 'text/less';
29
+ lessStyle.id = file;
30
+ lessStyle.href = file;
31
31
 
32
- if (lessStyle.styleSheet === undefined) {
33
- lessStyle.appendChild(document.createTextNode(lessText));
34
- }
32
+ if (lessStyle.styleSheet === undefined) {
33
+ lessStyle.appendChild(document.createTextNode(lessText));
34
+ }
35
35
 
36
- cssLink.rel = 'stylesheet';
37
- cssLink.type = 'text/css';
38
- cssLink.href = cssPath;
39
- cssLink.id = 'expected-' + file;
36
+ cssLink.rel = 'stylesheet';
37
+ cssLink.type = 'text/css';
38
+ cssLink.href = cssPath;
39
+ cssLink.id = 'expected-' + file;
40
40
 
41
- var head = document.getElementsByTagName('head')[0];
41
+ var head = document.getElementsByTagName('head')[0];
42
42
 
43
- head.appendChild(lessStyle);
43
+ head.appendChild(lessStyle);
44
44
 
45
- if (lessStyle.styleSheet) {
46
- lessStyle.styleSheet.cssText = lessText;
47
- }
45
+ if (lessStyle.styleSheet) {
46
+ lessStyle.styleSheet.cssText = lessText;
47
+ }
48
48
 
49
- head.appendChild(cssLink);
50
- testSheets[i] = lessStyle;
49
+ head.appendChild(cssLink);
50
+ testSheets[i] = lessStyle;
51
51
  }
@@ -1,3 +1,3 @@
1
1
  describe("less.js error tests", function() {
2
- testLessErrorsInDocument();
2
+ testLessErrorsInDocument();
3
3
  });
@@ -1,3 +1,3 @@
1
1
  describe("less.js global vars", function() {
2
- testLessEqualsInDocument();
2
+ testLessEqualsInDocument();
3
3
  });
@@ -5,14 +5,14 @@ var less = {
5
5
  less.strictMath = true;
6
6
  less.functions = {
7
7
  add: function(a, b) {
8
- return new(less.tree.Dimension)(a.value + b.value);
8
+ return new(less.tree.Dimension)(a.value + b.value);
9
9
  },
10
10
  increment: function(a) {
11
- return new(less.tree.Dimension)(a.value + 1);
11
+ return new(less.tree.Dimension)(a.value + 1);
12
12
  },
13
13
  _color: function(str) {
14
- if (str.value === "evil red") {
15
- return new(less.tree.Color)("600");
16
- }
14
+ if (str.value === "evil red") {
15
+ return new(less.tree.Color)("600");
16
+ }
17
17
  }
18
18
  };
@@ -2,6 +2,6 @@ console.warn("start spec");
2
2
  describe("less.js main tests", function() {
3
3
  testLessEqualsInDocument();
4
4
  it("the global environment", function() {
5
- expect(window.require).toBe(undefined);
5
+ expect(window.require).toBe(undefined);
6
6
  });
7
7
  });
package/test/copy-bom.js CHANGED
@@ -11,34 +11,34 @@ module.exports = function() {
11
11
  var _buff = new Buffer(BUF_LENGTH);
12
12
 
13
13
  function copyFolderWithBom(src, dest) {
14
- var stats = fs.lstatSync(src);
15
- var destFolder = path.dirname(dest);
16
- var destFolderExists = fs.existsSync(destFolder);
17
- var performCopy = false;
14
+ var stats = fs.lstatSync(src);
15
+ var destFolder = path.dirname(dest);
16
+ var destFolderExists = fs.existsSync(destFolder);
17
+ var performCopy = false;
18
18
 
19
- if (stats.isFile()) {
20
- if (!destFolderExists) {
21
- fs.mkdirSync(destFolder);
22
- }
23
- if (src.match(/\.(css|less)$/)) {
24
- copyFileAddingBomSync(src, dest);
25
- } else {
26
- copyFileSync(src, dest);
27
- }
28
- }
29
- else if (stats.isDirectory()) {
30
- if (!fs.existsSync(destFolder)) {
31
- fs.mkdirSync(destFolder);
32
- }
33
- if (!fs.existsSync(dest)) {
34
- fs.mkdirSync(dest);
19
+ if (stats.isFile()) {
20
+ if (!destFolderExists) {
21
+ fs.mkdirSync(destFolder);
22
+ }
23
+ if (src.match(/\.(css|less)$/)) {
24
+ copyFileAddingBomSync(src, dest);
25
+ } else {
26
+ copyFileSync(src, dest);
27
+ }
35
28
  }
36
- fs.readdirSync(src).forEach(function(d) {
37
- if (d !== 'bom') {
38
- copyFolderWithBom(path.join(src, d), path.join(dest, d));
29
+ else if (stats.isDirectory()) {
30
+ if (!fs.existsSync(destFolder)) {
31
+ fs.mkdirSync(destFolder);
32
+ }
33
+ if (!fs.existsSync(dest)) {
34
+ fs.mkdirSync(dest);
39
35
  }
40
- });
41
- }
36
+ fs.readdirSync(src).forEach(function(d) {
37
+ if (d !== 'bom') {
38
+ copyFolderWithBom(path.join(src, d), path.join(dest, d));
39
+ }
40
+ });
41
+ }
42
42
  }
43
43
 
44
44
  function copyFileAddingBomSync(srcFile, destFile) {
@@ -50,20 +50,20 @@ module.exports = function() {
50
50
  }
51
51
 
52
52
  function copyFileSync(srcFile, destFile) {
53
- var fdr = fs.openSync(srcFile, 'r')
54
- var stat = fs.fstatSync(fdr)
55
- var fdw = fs.openSync(destFile, 'w', stat.mode)
56
- var bytesRead = 1
57
- var pos = 0
53
+ var fdr = fs.openSync(srcFile, 'r');
54
+ var stat = fs.fstatSync(fdr);
55
+ var fdw = fs.openSync(destFile, 'w', stat.mode);
56
+ var bytesRead = 1;
57
+ var pos = 0;
58
58
 
59
59
  while (bytesRead > 0) {
60
- bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
61
- fs.writeSync(fdw, _buff, 0, bytesRead)
62
- pos += bytesRead
60
+ bytesRead = fs.readSync(fdr, _buff, 0, BUF_LENGTH, pos)
61
+ fs.writeSync(fdw, _buff, 0, bytesRead);
62
+ pos += bytesRead;
63
63
  }
64
64
 
65
- fs.closeSync(fdr)
66
- fs.closeSync(fdw)
65
+ fs.closeSync(fdr);
66
+ fs.closeSync(fdw);
67
67
  }
68
68
 
69
69
  return {
@@ -175,3 +175,11 @@
175
175
  format-keyword: hello;
176
176
  format-anonymous: hello anonymous world;
177
177
  }
178
+ #list-details {
179
+ length: 2;
180
+ one: a 1;
181
+ two: b 2;
182
+ two-length: 2;
183
+ two-one: b;
184
+ two-two: 2;
185
+ }
@@ -5,6 +5,7 @@ body {
5
5
  width: 100px;
6
6
  height: 100px;
7
7
  background: url('../assets/logo.png');
8
+ background: url("#inline-svg");
8
9
  }
9
10
 
10
11
  .a {
@@ -49,3 +49,9 @@
49
49
  .when-calling-nested-with-param-issue-2394 {
50
50
  width: 10px !important;
51
51
  }
52
+ .class1-2421 {
53
+ margin: 5px !important;
54
+ }
55
+ .class2-2421 {
56
+ margin: 5px;
57
+ }
@@ -163,3 +163,8 @@ blank blank blank blank blank blank blank blank blank blank blank blank blank bl
163
163
  .selector:not(:hover) {
164
164
  test: global scope;
165
165
  }
166
+ .extend-this,
167
+ .active.first-level .second-level,
168
+ .first-level .second-level.active2 {
169
+ content: '\2661';
170
+ }
@@ -31,6 +31,7 @@
31
31
  width: 100px;
32
32
  height: 100px;
33
33
  background: url('assets/logo.png');
34
+ background: url("#inline-svg");
34
35
  }
35
36
  @font-face {
36
37
  font-family: xecret;
package/test/css/urls.css CHANGED
@@ -39,6 +39,7 @@
39
39
  width: 100px;
40
40
  height: 100px;
41
41
  background: url('import/assets/logo.png');
42
+ background: url("#inline-svg");
42
43
  }
43
44
  @font-face {
44
45
  font-family: xecret;
package/test/index.js CHANGED
@@ -40,6 +40,7 @@ lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: true, glo
40
40
  }
41
41
  return path.join('test/sourcemaps', filename) + '.json';
42
42
  });
43
+ lessTester.runTestSet({strictMath: true, strictUnits: true, sourceMap: {sourceMapFileInline: true}}, "sourcemaps-empty/", lessTester.testEmptySourcemap);
43
44
  lessTester.runTestSet({globalVars: true, banner: "/**\n * Test\n */\n"}, "globalVars/",
44
45
  null, null, null, function(name, type, baseFolder) { return path.join(baseFolder, name) + '.json'; });
45
46
  lessTester.runTestSet({modifyVars: true}, "modifyVars/",
@@ -49,4 +50,4 @@ lessTester.runTestSet({paths: ['test/data/', 'test/less/import/']}, "include-pat
49
50
  lessTester.testSyncronous({syncImport: true}, "import");
50
51
  lessTester.testSyncronous({syncImport: true}, "css");
51
52
  lessTester.testNoOptions();
52
- lessTester.finished();
53
+ lessTester.finished();
@@ -199,3 +199,16 @@
199
199
  }
200
200
  }
201
201
 
202
+ #list-details {
203
+ @list:
204
+ a 1, // Some comment
205
+ b 2;
206
+
207
+ length: length(@list);
208
+ one: extract(@list, 1);
209
+ @two: extract(@list, 2);
210
+ two: @two;
211
+ two-length: length(@two);
212
+ two-one: extract(@two, 1);
213
+ two-two: extract(@two, 2);
214
+ }
@@ -2,4 +2,5 @@
2
2
  width: 100px;
3
3
  height: 100px;
4
4
  background: url('../assets/logo.png');
5
+ background: url("#inline-svg");
5
6
  }
@@ -34,4 +34,20 @@
34
34
  }
35
35
  .when-calling-nested-with-param-issue-2394 {
36
36
  .size(10px) !important;
37
- }
37
+ }
38
+ .testMixin-2421 () {
39
+ .topCheck-2421 () {
40
+ .nestedCheck-2421() {
41
+ margin: 5px;
42
+ }
43
+ .nestedCheck-2421();
44
+ }
45
+ .topCheck-2421();
46
+ }
47
+ .class1-2421 {
48
+ .testMixin-2421() !important;
49
+ }
50
+ .class2-2421 {
51
+ .testMixin-2421();
52
+ }
53
+
@@ -172,3 +172,13 @@ blank blank blank blank blank blank blank blank blank blank blank blank blank bl
172
172
  .selector:not(&:hover) {
173
173
  test: global scope;
174
174
  }
175
+ // https://github.com/less/less.js/issues/2206
176
+ .extend-this {
177
+ content: '\2661';
178
+ }
179
+ .first-level {
180
+ .second-level {
181
+ .active&:extend(.extend-this) { }
182
+ &.active2:extend(.extend-this) { }
183
+ }
184
+ }
File without changes
@@ -0,0 +1 @@
1
+ @test-var: 'something';
@@ -47,7 +47,7 @@
47
47
  uri: data-uri('image/jpeg;base64', '../data/image.jpg');
48
48
  @var: replace('../data/replace.jpg', "replace", "image");
49
49
  background-image: data-uri(@var), data-uri(replace('../data/image.filext', "filext", "jpg"));
50
-
50
+
51
51
  uri-fragment: data-uri('image/jpeg;base64', '../data/image.jpg#fragment');
52
52
  }
53
53
 
package/test/less-test.js CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  module.exports = function() {
4
4
  var path = require('path'),
5
- fs = require('fs');
6
- copyBom = require('./copy-bom')();
5
+ fs = require('fs'),
6
+ copyBom = require('./copy-bom')(),
7
+ doBomTest = false;
7
8
 
8
9
  var less = require('../lib/less-node');
9
10
  var stylize = require('../lib/less-node/lessc-helper').stylize;
@@ -88,6 +89,23 @@ module.exports = function() {
88
89
  });
89
90
  }
90
91
 
92
+ function testEmptySourcemap(name, err, compiledLess, doReplacements, sourcemap, baseFolder) {
93
+ process.stdout.write("- " + path.join(baseFolder, name) + ": ");
94
+ if (err) {
95
+ fail("ERROR: " + (err && err.message));
96
+ } else {
97
+ var expectedSourcemap = undefined;
98
+ if ( compiledLess !== "" ) {
99
+ difference("\nCompiledLess must be empty", "", compiledLess);
100
+
101
+ } else if (sourcemap !== expectedSourcemap) {
102
+ fail("Sourcemap must be undefined");
103
+ } else {
104
+ ok('OK');
105
+ }
106
+ }
107
+ }
108
+
91
109
  function testErrors(name, err, compiledLess, doReplacements, sourcemap, baseFolder) {
92
110
  fs.readFile(path.join(baseFolder, name) + '.txt', 'utf8', function (e, expectedErr) {
93
111
  process.stdout.write("- " + path.join(baseFolder, name) + ": ");
@@ -134,29 +152,32 @@ module.exports = function() {
134
152
  }
135
153
  totalTests++;
136
154
  queue(function() {
137
- var isSync = true;
138
- toCSS(options, path.join(normalFolder, filenameNoExtension + ".less"), function (err, result) {
139
- process.stdout.write("- Test Sync " + filenameNoExtension + ": ");
155
+ var isSync = true;
156
+ toCSS(options, path.join(normalFolder, filenameNoExtension + ".less"), function (err, result) {
157
+ process.stdout.write("- Test Sync " + filenameNoExtension + ": ");
140
158
 
141
- if (isSync) {
142
- ok("OK");
143
- } else {
144
- fail("Not Sync");
145
- }
146
- release();
147
- });
148
- isSync = false;
159
+ if (isSync) {
160
+ ok("OK");
161
+ } else {
162
+ fail("Not Sync");
163
+ }
164
+ release();
165
+ });
166
+ isSync = false;
149
167
  });
150
168
  }
151
169
 
152
170
  function prepBomTest() {
153
- copyBom.copyFolderWithBom(normalFolder, bomFolder);
171
+ copyBom.copyFolderWithBom(normalFolder, bomFolder);
172
+ doBomTest = true;
154
173
  }
155
174
 
156
175
  function runTestSet(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
157
176
  var options2 = options ? JSON.parse(JSON.stringify(options)) : {};
158
177
  runTestSetInternal(normalFolder, options, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
159
- runTestSetInternal(bomFolder, options2, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
178
+ if (doBomTest) {
179
+ runTestSetInternal(bomFolder, options2, foldername, verifyFunction, nameModifier, doReplacements, getFilename);
180
+ }
160
181
  }
161
182
 
162
183
  function runTestSetNormalOnly(options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
@@ -166,12 +187,12 @@ module.exports = function() {
166
187
  function runTestSetInternal(baseFolder, options, foldername, verifyFunction, nameModifier, doReplacements, getFilename) {
167
188
  foldername = foldername || "";
168
189
 
169
- if(!doReplacements) {
190
+ if (!doReplacements) {
170
191
  doReplacements = globalReplacements;
171
192
  }
172
193
 
173
194
  function getBasename(file) {
174
- return foldername + path.basename(file, '.less');
195
+ return foldername + path.basename(file, '.less');
175
196
  }
176
197
 
177
198
  fs.readdirSync(path.join(baseFolder, foldername)).forEach(function (file) {
@@ -185,7 +206,7 @@ module.exports = function() {
185
206
 
186
207
  totalTests++;
187
208
 
188
- if (options.sourceMap) {
209
+ if (options.sourceMap && !options.sourceMap.sourceMapFileInline) {
189
210
  options.sourceMapOutputFilename = name + ".css";
190
211
  options.sourceMapBasepath = path.join(process.cwd(), baseFolder);
191
212
  options.sourceMapRootpath = "testweb/";
@@ -224,11 +245,11 @@ module.exports = function() {
224
245
  return;
225
246
  }
226
247
  var css_name = name;
227
- if(nameModifier) { css_name = nameModifier(name); }
248
+ if (nameModifier) { css_name = nameModifier(name); }
228
249
  fs.readFile(path.join('test/css', css_name) + '.css', 'utf8', function (e, css) {
229
250
  process.stdout.write("- " + path.join(baseFolder, css_name) + ": ");
230
251
 
231
- css = css && doReplacements(css, path.join(baseFolder, foldername));
252
+ css = css && doReplacements(css, path.join(baseFolder, foldername));
232
253
  if (result.css === css) { ok('OK'); }
233
254
  else {
234
255
  difference("FAIL", css, result.css);
@@ -242,12 +263,12 @@ module.exports = function() {
242
263
 
243
264
  function diff(left, right) {
244
265
  require('diff').diffLines(left, right).forEach(function(item) {
245
- if(item.added || item.removed) {
246
- var text = item.value.replace("\n", String.fromCharCode(182) + "\n").replace('\ufeff', '[[BOM]]');
247
- process.stdout.write(stylize(text, item.added ? 'green' : 'red'));
248
- } else {
249
- process.stdout.write(item.value.replace('\ufeff', '[[BOM]]'));
250
- }
266
+ if (item.added || item.removed) {
267
+ var text = item.value && item.value.replace("\n", String.fromCharCode(182) + "\n").replace('\ufeff', '[[BOM]]');
268
+ process.stdout.write(stylize(text, item.added ? 'green' : 'red'));
269
+ } else {
270
+ process.stdout.write(item.value && item.value.replace('\ufeff', '[[BOM]]'));
271
+ }
251
272
  });
252
273
  process.stdout.write("\n");
253
274
  }
@@ -313,7 +334,7 @@ module.exports = function() {
313
334
 
314
335
  options.paths = options.paths || [];
315
336
  if (!contains(options.paths, addPath)) {
316
- options.paths.push(addPath);
337
+ options.paths.push(addPath);
317
338
  }
318
339
  options.filename = require('path').resolve(process.cwd(), path);
319
340
  options.optimization = options.optimization || 0;
@@ -348,6 +369,7 @@ module.exports = function() {
348
369
  testSyncronous: testSyncronous,
349
370
  testErrors: testErrors,
350
371
  testSourcemap: testSourcemap,
372
+ testEmptySourcemap: testEmptySourcemap,
351
373
  testNoOptions: testNoOptions,
352
374
  prepBomTest: prepBomTest,
353
375
  finished: finished
@@ -1,19 +1,19 @@
1
1
  var less = require('../lib/less'),
2
- fs = require('fs')
2
+ fs = require('fs');
3
3
 
4
- var input = fs.readFileSync("./test/less/modifyVars/extended.less", 'utf8')
5
- var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8')
4
+ var input = fs.readFileSync("./test/less/modifyVars/extended.less", 'utf8');
5
+ var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8');
6
6
  var options = {
7
- modifyVars: JSON.parse(fs.readFileSync("./test/less/modifyVars/extended.json", 'utf8'))
8
- }
7
+ modifyVars: JSON.parse(fs.readFileSync("./test/less/modifyVars/extended.json", 'utf8'))
8
+ };
9
9
 
10
10
  less.render(input, options, function (err, result) {
11
- if (err) {
12
- console.log(err);
13
- }
14
- if (result.css === expectedCss) {
15
- console.log("PASS");
16
- } else {
17
- console.log("FAIL");
18
- }
11
+ if (err) {
12
+ console.log(err);
13
+ }
14
+ if (result.css === expectedCss) {
15
+ console.log("PASS");
16
+ } else {
17
+ console.log("FAIL");
18
+ }
19
19
  });