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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## 3.9.0
2
+
3
+ 2018-11-28
4
+ - Added `range([start=1], end, [step=1])` function to generate lists
5
+ - Fixes #3325 #3313 #3328
6
+
7
+ ## 3.8.1
8
+
9
+ 2018-08-07
10
+ - Fixes for sourcemaps and color functions
11
+ - Support for #RRGGBBAA color format
12
+ - Allows conversion of colors to `rgba()` or `hsla()`
13
+ - Pass-through output of unknown properties in color functions (allows `var(--color)` for example)
14
+
15
+ ## 3.8.0
16
+
17
+ 2018-07-22
18
+ - New feature: added rewrite urls to replace relative url option. Adds "local" option for modules
19
+
20
+ ## 3.7.1
21
+
22
+ 2018-07-11
23
+ - Fixes mistake in `lessc` (using `console.warning` instead of actual `console.warn`)
24
+ - Adds `lessc` tests
25
+
26
+ ## 3.7.0
27
+
28
+ 2018-07-11
29
+ - New each() function! [See docs](http://lesscss.org/functions/#list-functions-each)
30
+ - New math modes! Also [see docs](http://lesscss.org/usage/#less-options-math).
31
+ - Bug fixes
32
+
1
33
  ## 3.6.0
2
34
 
3
35
  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: {
@@ -208,7 +227,8 @@ module.exports = function (grunt) {
208
227
  options: {
209
228
  exclude: ['promise'],
210
229
  browserifyOptions: {
211
- standalone: 'less'
230
+ standalone: 'less',
231
+ noParse: ['clone']
212
232
  }
213
233
  },
214
234
  dest: 'tmp/less.js'
@@ -273,6 +293,7 @@ module.exports = function (grunt) {
273
293
  keepRunner: true,
274
294
  host: 'http://localhost:8081/',
275
295
  vendor: [
296
+ './node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js',
276
297
  'test/browser/vendor/promise.js',
277
298
  'test/browser/jasmine-jsreporter.js',
278
299
  'test/browser/common.js',
@@ -347,6 +368,14 @@ module.exports = function (grunt) {
347
368
  outfile: 'tmp/browser/test-runner-relative-urls.html'
348
369
  }
349
370
  },
371
+ rewriteUrls: {
372
+ src: ['test/browser/less/rewrite-urls/*.less'],
373
+ options: {
374
+ helpers: 'test/browser/runner-rewrite-urls-options.js',
375
+ specs: 'test/browser/runner-rewrite-urls-spec.js',
376
+ outfile: 'tmp/browser/test-runner-rewrite-urls.html'
377
+ }
378
+ },
350
379
  rootpath: {
351
380
  src: ['test/browser/less/rootpath/*.less'],
352
381
  options: {
@@ -363,6 +392,14 @@ module.exports = function (grunt) {
363
392
  outfile: 'tmp/browser/test-runner-rootpath-relative.html'
364
393
  }
365
394
  },
395
+ rootpathRewriteUrls: {
396
+ src: ['test/browser/less/rootpath-rewrite-urls/*.less'],
397
+ options: {
398
+ helpers: 'test/browser/runner-rootpath-rewrite-urls-options.js',
399
+ specs: 'test/browser/runner-rootpath-rewrite-urls-spec.js',
400
+ outfile: 'tmp/browser/test-runner-rootpath-rewrite-urls.html'
401
+ }
402
+ },
366
403
  production: {
367
404
  src: ['test/browser/less/production/*.less'],
368
405
  options: {
@@ -437,9 +474,6 @@ module.exports = function (grunt) {
437
474
 
438
475
  require('jit-grunt')(grunt);
439
476
 
440
- // Actually load this plugin's task(s).
441
- grunt.loadTasks('build/tasks');
442
-
443
477
  // by default, run tests
444
478
  grunt.registerTask('default', [
445
479
  'test'
@@ -503,6 +537,7 @@ module.exports = function (grunt) {
503
537
  'clean',
504
538
  'eslint',
505
539
  'shell:test',
540
+ 'shell:opts',
506
541
  'shell:plugin',
507
542
  'browsertest'
508
543
  ];
@@ -518,6 +553,9 @@ module.exports = function (grunt) {
518
553
  // Run all tests
519
554
  grunt.registerTask('test', testTasks);
520
555
 
556
+ // Run shell option tests (includes deprecated options)
557
+ grunt.registerTask('shell-options', ['shell:opts']);
558
+
521
559
  // Run shell plugin test
522
560
  grunt.registerTask('shell-plugin', ['shell:plugin']);
523
561
 
package/bin/lessc CHANGED
@@ -4,7 +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
- MATH = require('../lib/less/math-constants'),
7
+ Constants = require('../lib/less/constants'),
8
8
  errno,
9
9
  mkdirp;
10
10
 
@@ -476,16 +476,35 @@ function processPluginQueue() {
476
476
  options.rootpath = match[2].replace(/\\/g, '/');
477
477
  }
478
478
  break;
479
- case 'ru':
480
479
  case 'relative-urls':
481
- 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
+ }
482
501
  break;
483
502
  case 'sm':
484
503
  case 'strict-math':
485
- console.warning('--strict-math is deprecated. Use --math=strict');
504
+ console.warn('The --strict-math option has been deprecated. Use --math=strict.');
486
505
  if (checkArgFunc(arg, match[2])) {
487
506
  if (checkBooleanArg(match[2])) {
488
- options.math = MATH.STRICT_LEGACY;
507
+ options.math = Constants.Math.STRICT_LEGACY;
489
508
  }
490
509
  }
491
510
  break;