less 3.6.0 → 3.8.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 (142) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/Gruntfile.js +43 -6
  3. package/bin/lessc +32 -3
  4. package/dist/less.js +2810 -326
  5. package/dist/less.min.js +7 -7
  6. package/lib/less/constants.js +13 -0
  7. package/lib/less/contexts.js +45 -10
  8. package/lib/less/default-options.js +12 -4
  9. package/lib/less/functions/color.js +84 -41
  10. package/lib/less/functions/data-uri.js +1 -1
  11. package/lib/less/functions/index.js +1 -0
  12. package/lib/less/functions/list.js +101 -0
  13. package/lib/less/functions/types.js +1 -19
  14. package/lib/less/import-manager.js +3 -3
  15. package/lib/less/index.js +1 -1
  16. package/lib/less/parse.js +3 -3
  17. package/lib/less/parser/parser.js +31 -13
  18. package/lib/less/render.js +2 -2
  19. package/lib/less/source-map-output.js +2 -2
  20. package/lib/less/tree/color.js +58 -18
  21. package/lib/less/tree/declaration.js +11 -7
  22. package/lib/less/tree/expression.js +7 -3
  23. package/lib/less/tree/import.js +9 -8
  24. package/lib/less/tree/mixin-definition.js +1 -1
  25. package/lib/less/tree/operation.js +10 -4
  26. package/lib/less/tree/url.js +12 -8
  27. package/lib/less/utils.js +54 -19
  28. package/lib/less-browser/add-default-options.js +3 -3
  29. package/lib/less-browser/index.js +9 -2
  30. package/lib/less-node/image-size.js +1 -1
  31. package/lib/less-node/lessc-helper.js +12 -4
  32. package/package.json +5 -2
  33. package/test/browser/css/rewrite-urls/urls.css +36 -0
  34. package/test/browser/css/rootpath-rewrite-urls/urls.css +35 -0
  35. package/test/browser/less/rewrite-urls/urls.less +34 -0
  36. package/test/browser/less/rootpath-rewrite-urls/urls.less +33 -0
  37. package/test/browser/less.js +2810 -326
  38. package/test/browser/runner-browser-options.js +1 -1
  39. package/test/browser/runner-errors-options.js +1 -1
  40. package/test/browser/runner-legacy-options.js +1 -1
  41. package/test/browser/runner-rewrite-urls-options.js +3 -0
  42. package/test/browser/runner-rewrite-urls-spec.js +3 -0
  43. package/test/browser/runner-rootpath-relative-spec.js +1 -1
  44. package/test/browser/runner-rootpath-rewrite-urls-options.js +4 -0
  45. package/test/browser/runner-rootpath-rewrite-urls-spec.js +3 -0
  46. package/test/css/calc.css +2 -2
  47. package/test/css/colors.css +20 -3
  48. package/test/css/css-3.css +0 -8
  49. package/test/css/css-escapes.css +3 -0
  50. package/test/css/functions-each.css +48 -0
  51. package/test/css/functions.css +6 -4
  52. package/test/css/math/parens-division/media-math.css +10 -0
  53. package/test/css/math/parens-division/mixins-args.css +169 -0
  54. package/test/css/math/parens-division/new-division.css +16 -0
  55. package/test/css/math/parens-division/parens.css +37 -0
  56. package/test/css/math/strict/css.css +95 -0
  57. package/test/css/math/strict/media-math.css +10 -0
  58. package/test/css/math/strict/mixins-args.css +169 -0
  59. package/test/css/math/strict/parens.css +37 -0
  60. package/test/css/{strict-math → math/strict-legacy}/css.css +0 -0
  61. package/test/css/math/strict-legacy/media-math.css +10 -0
  62. package/test/css/{strict-math → math/strict-legacy}/mixins-args.css +0 -0
  63. package/test/css/{strict-math → math/strict-legacy}/parens.css +5 -1
  64. package/test/css/no-strict-math/no-sm-operations.css +3 -0
  65. package/test/css/rewrite-urls-all/rewrite-urls-all.css +17 -0
  66. package/test/css/rewrite-urls-local/rewrite-urls-local.css +17 -0
  67. package/test/css/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.css +17 -0
  68. package/test/css/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.css +17 -0
  69. package/test/css/static-urls/urls.css +2 -2
  70. package/test/css/urls.css +2 -2
  71. package/test/index.js +28 -15
  72. package/test/less/colors.less +18 -0
  73. package/test/less/css-3.less +0 -9
  74. package/test/less/css-escapes.less +4 -0
  75. package/test/less/errors/color-func-invalid-color.txt +1 -1
  76. package/test/less/errors/mixin-not-defined-2.less +7 -0
  77. package/test/less/errors/mixin-not-defined-2.txt +4 -0
  78. package/test/less/functions-each.less +81 -0
  79. package/test/less/functions.less +14 -2
  80. package/test/less/math/parens-division/media-math.less +9 -0
  81. package/test/less/math/parens-division/mixins-args.less +264 -0
  82. package/test/less/math/parens-division/new-division.less +17 -0
  83. package/test/less/{strict-math → math/parens-division}/parens.less +2 -1
  84. package/test/less/math/strict/css.less +108 -0
  85. package/test/less/math/strict/media-math.less +9 -0
  86. package/test/less/math/strict/mixins-args.less +264 -0
  87. package/test/less/math/strict/parens.less +46 -0
  88. package/test/less/{strict-math → math/strict-legacy}/css.less +0 -0
  89. package/test/less/math/strict-legacy/media-math.less +9 -0
  90. package/test/less/{strict-math → math/strict-legacy}/mixins-args.less +0 -0
  91. package/test/less/math/strict-legacy/parens.less +50 -0
  92. package/test/less/no-strict-math/no-sm-operations.less +3 -0
  93. package/test/less/rewrite-urls-all/folder/file.less +8 -0
  94. package/test/less/rewrite-urls-all/rewrite-urls-all.less +11 -0
  95. package/test/less/rewrite-urls-local/folder/file.less +8 -0
  96. package/test/less/rewrite-urls-local/rewrite-urls-local.less +11 -0
  97. package/test/less/rootpath-rewrite-urls-all/folder/file.less +8 -0
  98. package/test/less/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.less +11 -0
  99. package/test/less/rootpath-rewrite-urls-local/folder/file.less +8 -0
  100. package/test/less/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.less +11 -0
  101. package/test/less/sourcemaps/custom-props.less +8 -0
  102. package/test/less-bom/colors.less +18 -0
  103. package/test/less-bom/css-3.less +0 -9
  104. package/test/less-bom/css-escapes.less +4 -0
  105. package/test/less-bom/errors/color-func-invalid-color.txt +1 -1
  106. package/test/less-bom/errors/mixin-not-defined-2.less +7 -0
  107. package/test/less-bom/errors/mixin-not-defined-2.txt +4 -0
  108. package/test/less-bom/functions-each.less +81 -0
  109. package/test/less-bom/functions.less +14 -2
  110. package/test/less-bom/math/parens-division/media-math.less +9 -0
  111. package/test/less-bom/math/parens-division/mixins-args.less +264 -0
  112. package/test/less-bom/math/parens-division/new-division.less +17 -0
  113. package/test/less-bom/{strict-math → math/parens-division}/parens.less +2 -1
  114. package/test/less-bom/math/strict/css.less +108 -0
  115. package/test/less-bom/math/strict/media-math.less +9 -0
  116. package/test/less-bom/math/strict/mixins-args.less +264 -0
  117. package/test/less-bom/math/strict/parens.less +46 -0
  118. package/test/less-bom/{strict-math → math/strict-legacy}/css.less +0 -0
  119. package/test/less-bom/math/strict-legacy/media-math.less +9 -0
  120. package/test/less-bom/{strict-math → math/strict-legacy}/mixins-args.less +0 -0
  121. package/test/less-bom/math/strict-legacy/parens.less +50 -0
  122. package/test/less-bom/no-strict-math/no-sm-operations.less +3 -0
  123. package/test/less-bom/rewrite-urls-all/folder/file.less +8 -0
  124. package/test/less-bom/rewrite-urls-all/rewrite-urls-all.less +11 -0
  125. package/test/less-bom/rewrite-urls-local/folder/file.less +8 -0
  126. package/test/less-bom/rewrite-urls-local/rewrite-urls-local.less +11 -0
  127. package/test/less-bom/rootpath-rewrite-urls-all/folder/file.less +8 -0
  128. package/test/less-bom/rootpath-rewrite-urls-all/rootpath-rewrite-urls-all.less +11 -0
  129. package/test/less-bom/rootpath-rewrite-urls-local/folder/file.less +8 -0
  130. package/test/less-bom/rootpath-rewrite-urls-local/rootpath-rewrite-urls-local.less +11 -0
  131. package/test/less-bom/sourcemaps/custom-props.less +8 -0
  132. package/test/less-test.js +26 -12
  133. package/test/sourcemaps/custom-props.json +1 -0
  134. package/.npmignore +0 -8
  135. package/test/less/errors/color-invalid-hex-code.less +0 -4
  136. package/test/less/errors/color-invalid-hex-code.txt +0 -4
  137. package/test/less/errors/color-invalid-hex-code2.less +0 -4
  138. package/test/less/errors/color-invalid-hex-code2.txt +0 -4
  139. package/test/less-bom/errors/color-invalid-hex-code.less +0 -4
  140. package/test/less-bom/errors/color-invalid-hex-code.txt +0 -4
  141. package/test/less-bom/errors/color-invalid-hex-code2.less +0 -4
  142. package/test/less-bom/errors/color-invalid-hex-code2.txt +0 -4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 3.7.1
2
+
3
+ 2018-07-11
4
+ - Fixes mistake in `lessc` (using `console.warning` instead of actual `console.warn`)
5
+ - Adds `lessc` tests
6
+
7
+ ## 3.7.0
8
+
9
+ 2018-07-11
10
+ - New each() function! [See docs](http://lesscss.org/functions/#list-functions-each)
11
+ - New math modes! Also [see docs](http://lesscss.org/usage/#less-options-math).
12
+ - Bug fixes
13
+
1
14
  ## 3.6.0
2
15
 
3
16
  2018-07-10
package/Gruntfile.js CHANGED
@@ -70,14 +70,18 @@ module.exports = function (grunt) {
70
70
 
71
71
  var sauceJobs = {};
72
72
 
73
- var browserTests = [ 'filemanager-plugin',
73
+
74
+ var browserTests = [
75
+ 'filemanager-plugin',
74
76
  'visitor-plugin',
75
77
  'global-vars',
76
78
  'modify-vars',
77
79
  'production',
78
80
  'rootpath-relative',
81
+ 'rootpath-rewrite-urls',
79
82
  'rootpath',
80
83
  'relative-urls',
84
+ 'rewrite-urls',
81
85
  'browser',
82
86
  'no-js-errors',
83
87
  'legacy'
@@ -184,6 +188,21 @@ module.exports = function (grunt) {
184
188
  benchmark: {
185
189
  command: 'node benchmark/index.js'
186
190
  },
191
+ opts: { // test running with all current options (using `opts` since `options` means something already)
192
+ command: [ // @TODO: make this more thorough
193
+ // CURRENT OPTIONS
194
+ // --math
195
+ 'node bin/lessc --math=always test/less/lazy-eval.less tmp/lazy-eval.css',
196
+ 'node bin/lessc --math=parens-division test/less/lazy-eval.less tmp/lazy-eval.css',
197
+ 'node bin/lessc --math=parens test/less/lazy-eval.less tmp/lazy-eval.css',
198
+ 'node bin/lessc --math=strict test/less/lazy-eval.less tmp/lazy-eval.css',
199
+ 'node bin/lessc --math=strict-legacy test/less/lazy-eval.less tmp/lazy-eval.css',
200
+
201
+ // DEPRECATED OPTIONS
202
+ // --strict-math
203
+ 'node bin/lessc --strict-math=on test/less/lazy-eval.less tmp/lazy-eval.css',
204
+ ].join(' && ')
205
+ },
187
206
  plugin: {
188
207
  command: [
189
208
  'node bin/lessc --clean-css="--s1 --advanced" test/less/lazy-eval.less tmp/lazy-eval.css',
@@ -194,12 +213,12 @@ module.exports = function (grunt) {
194
213
  'node bin/lessc --plugin=clean-css="--s1 --advanced" --plugin=autoprefix="ie 11,Edge >= 13,Chrome >= 47,Firefox >= 45,iOS >= 9.2,Safari >= 9" test/less/lazy-eval.less tmp/lazy-eval.css'
195
214
  ].join(' && ')
196
215
  },
197
- 'sourcemap-test': {
216
+ 'sourcemap-test': { // quoted value doesn't seem to get picked up by time-grunt, or isn't output, at least; maybe just "sourcemap" is fine?
198
217
  command: [
199
218
  'node bin/lessc --source-map=test/sourcemaps/maps/import-map.map test/less/import.less test/sourcemaps/import.css',
200
219
  'node bin/lessc --source-map test/less/sourcemaps/basic.less test/sourcemaps/basic.css'
201
220
  ].join(' && ')
202
- }
221
+ },
203
222
  },
204
223
 
205
224
  browserify: {
@@ -273,6 +292,7 @@ module.exports = function (grunt) {
273
292
  keepRunner: true,
274
293
  host: 'http://localhost:8081/',
275
294
  vendor: [
295
+ './node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js',
276
296
  'test/browser/vendor/promise.js',
277
297
  'test/browser/jasmine-jsreporter.js',
278
298
  'test/browser/common.js',
@@ -347,6 +367,14 @@ module.exports = function (grunt) {
347
367
  outfile: 'tmp/browser/test-runner-relative-urls.html'
348
368
  }
349
369
  },
370
+ rewriteUrls: {
371
+ src: ['test/browser/less/rewrite-urls/*.less'],
372
+ options: {
373
+ helpers: 'test/browser/runner-rewrite-urls-options.js',
374
+ specs: 'test/browser/runner-rewrite-urls-spec.js',
375
+ outfile: 'tmp/browser/test-runner-rewrite-urls.html'
376
+ }
377
+ },
350
378
  rootpath: {
351
379
  src: ['test/browser/less/rootpath/*.less'],
352
380
  options: {
@@ -363,6 +391,14 @@ module.exports = function (grunt) {
363
391
  outfile: 'tmp/browser/test-runner-rootpath-relative.html'
364
392
  }
365
393
  },
394
+ rootpathRewriteUrls: {
395
+ src: ['test/browser/less/rootpath-rewrite-urls/*.less'],
396
+ options: {
397
+ helpers: 'test/browser/runner-rootpath-rewrite-urls-options.js',
398
+ specs: 'test/browser/runner-rootpath-rewrite-urls-spec.js',
399
+ outfile: 'tmp/browser/test-runner-rootpath-rewrite-urls.html'
400
+ }
401
+ },
366
402
  production: {
367
403
  src: ['test/browser/less/production/*.less'],
368
404
  options: {
@@ -437,9 +473,6 @@ module.exports = function (grunt) {
437
473
 
438
474
  require('jit-grunt')(grunt);
439
475
 
440
- // Actually load this plugin's task(s).
441
- grunt.loadTasks('build/tasks');
442
-
443
476
  // by default, run tests
444
477
  grunt.registerTask('default', [
445
478
  'test'
@@ -503,6 +536,7 @@ module.exports = function (grunt) {
503
536
  'clean',
504
537
  'eslint',
505
538
  'shell:test',
539
+ 'shell:opts',
506
540
  'shell:plugin',
507
541
  'browsertest'
508
542
  ];
@@ -518,6 +552,9 @@ module.exports = function (grunt) {
518
552
  // Run all tests
519
553
  grunt.registerTask('test', testTasks);
520
554
 
555
+ // Run shell option tests (includes deprecated options)
556
+ grunt.registerTask('shell-options', ['shell:opts']);
557
+
521
558
  // Run shell plugin test
522
559
  grunt.registerTask('shell-plugin', ['shell:plugin']);
523
560
 
package/bin/lessc CHANGED
@@ -4,6 +4,7 @@ var path = require('path'),
4
4
  fs = require('../lib/less-node/fs'),
5
5
  os = require('os'),
6
6
  utils = require('../lib/less/utils'),
7
+ Constants = require('../lib/less/constants'),
7
8
  errno,
8
9
  mkdirp;
9
10
 
@@ -475,14 +476,42 @@ function processPluginQueue() {
475
476
  options.rootpath = match[2].replace(/\\/g, '/');
476
477
  }
477
478
  break;
478
- case 'ru':
479
479
  case 'relative-urls':
480
- options.relativeUrls = true;
480
+ console.warn('The --relative-urls option has been deprecated. Use --rewrite-urls=all.');
481
+ options.rewriteUrls = Constants.RewriteUrls.ALL;
482
+ break;
483
+ case 'ru':
484
+ case 'rewrite-urls':
485
+ var m = match[2];
486
+ if (m) {
487
+ if (m === 'local') {
488
+ options.rewriteUrls = Constants.RewriteUrls.LOCAL;
489
+ } else if (m === 'off') {
490
+ options.rewriteUrls = Constants.RewriteUrls.OFF;
491
+ } else if (m === 'all') {
492
+ options.rewriteUrls = Constants.RewriteUrls.ALL;
493
+ } else {
494
+ console.error('Unknown rewrite-urls argument ' + m);
495
+ continueProcessing = false;
496
+ process.exitCode = 1;
497
+ }
498
+ } else {
499
+ options.rewriteUrls = Constants.RewriteUrls.ALL;
500
+ }
481
501
  break;
482
502
  case 'sm':
483
503
  case 'strict-math':
504
+ console.warn('The --strict-math option has been deprecated. Use --math=strict.');
505
+ if (checkArgFunc(arg, match[2])) {
506
+ if (checkBooleanArg(match[2])) {
507
+ options.math = Constants.Math.STRICT_LEGACY;
508
+ }
509
+ }
510
+ break;
511
+ case 'm':
512
+ case 'math':
484
513
  if (checkArgFunc(arg, match[2])) {
485
- options.strictMath = checkBooleanArg(match[2]);
514
+ options.math = match[2];
486
515
  }
487
516
  break;
488
517
  case 'su':