less 2.1.2 → 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 (148) 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 +499 -760
  5. package/.jscsrc +73 -0
  6. package/.jshintrc +0 -2
  7. package/.travis.yml +1 -0
  8. package/CHANGELOG.md +59 -0
  9. package/Gruntfile.js +37 -3
  10. package/appveyor.yml +5 -0
  11. package/bin/lessc +383 -316
  12. package/bower.json +1 -1
  13. package/dist/less.js +1638 -1244
  14. package/dist/less.min.js +7 -7
  15. package/lib/less/contexts.js +3 -3
  16. package/lib/less/data/unit-conversions.js +3 -3
  17. package/lib/less/environment/abstract-file-manager.js +8 -8
  18. package/lib/less/environment/environment.js +2 -2
  19. package/lib/less/functions/color-blending.js +3 -3
  20. package/lib/less/functions/color.js +20 -12
  21. package/lib/less/functions/data-uri.js +26 -18
  22. package/lib/less/functions/math.js +1 -1
  23. package/lib/less/functions/number.js +2 -2
  24. package/lib/less/functions/string.js +3 -1
  25. package/lib/less/functions/svg.js +12 -15
  26. package/lib/less/functions/types.js +33 -10
  27. package/lib/less/import-manager.js +14 -9
  28. package/lib/less/index.js +2 -1
  29. package/lib/less/less-error.js +1 -1
  30. package/lib/less/logger.js +2 -2
  31. package/lib/less/parse-tree.js +48 -42
  32. package/lib/less/parse.js +68 -0
  33. package/lib/less/parser/parser-input.js +6 -5
  34. package/lib/less/parser/parser.js +76 -29
  35. package/lib/less/plugin-manager.js +30 -3
  36. package/lib/less/render.js +11 -37
  37. package/lib/less/source-map-builder.js +4 -0
  38. package/lib/less/source-map-output.js +6 -6
  39. package/lib/less/transform-tree.js +4 -4
  40. package/lib/less/tree/anonymous.js +1 -1
  41. package/lib/less/tree/assignment.js +0 -1
  42. package/lib/less/tree/call.js +1 -1
  43. package/lib/less/tree/color.js +6 -6
  44. package/lib/less/tree/condition.js +9 -5
  45. package/lib/less/tree/debug-info.js +6 -2
  46. package/lib/less/tree/dimension.js +5 -5
  47. package/lib/less/tree/directive.js +25 -6
  48. package/lib/less/tree/element.js +1 -1
  49. package/lib/less/tree/expression.js +2 -2
  50. package/lib/less/tree/extend.js +3 -3
  51. package/lib/less/tree/import.js +2 -2
  52. package/lib/less/tree/index.js +1 -0
  53. package/lib/less/tree/javascript.js +2 -2
  54. package/lib/less/tree/media.js +20 -19
  55. package/lib/less/tree/mixin-call.js +5 -6
  56. package/lib/less/tree/mixin-definition.js +33 -11
  57. package/lib/less/tree/quoted.js +3 -3
  58. package/lib/less/tree/rule.js +3 -4
  59. package/lib/less/tree/ruleset.js +290 -177
  60. package/lib/less/tree/selector.js +3 -2
  61. package/lib/less/tree/unit.js +2 -0
  62. package/lib/less/tree/url.js +5 -2
  63. package/lib/less/tree/value.js +2 -2
  64. package/lib/less/tree/variable.js +1 -1
  65. package/lib/less/visitors/extend-visitor.js +72 -36
  66. package/lib/less/visitors/import-sequencer.js +20 -14
  67. package/lib/less/visitors/import-visitor.js +15 -12
  68. package/lib/less/visitors/to-css-visitor.js +41 -9
  69. package/lib/less-browser/add-default-options.js +5 -1
  70. package/lib/less-browser/bootstrap.js +10 -8
  71. package/lib/less-browser/cache.js +3 -3
  72. package/lib/less-browser/file-manager.js +96 -96
  73. package/lib/less-browser/index.js +206 -205
  74. package/lib/less-browser/log-listener.js +2 -2
  75. package/lib/less-browser/utils.js +6 -6
  76. package/lib/less-node/file-manager.js +58 -30
  77. package/lib/less-node/image-size.js +34 -0
  78. package/lib/less-node/index.js +6 -3
  79. package/lib/less-node/lessc-helper.js +3 -2
  80. package/lib/less-node/plugin-loader.js +3 -3
  81. package/lib/less-node/url-file-manager.js +6 -3
  82. package/lib/less-rhino/index.js +15 -13
  83. package/lib/source-map/source-map-0.1.31.js +1 -1
  84. package/package.json +10 -7
  85. package/test/browser/common.js +13 -11
  86. package/test/browser/css/relative-urls/urls.css +1 -0
  87. package/test/browser/css/urls.css +6 -3
  88. package/test/browser/jasmine-jsreporter.js +2 -3
  89. package/test/browser/less/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
  90. package/test/browser/less/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
  91. package/test/browser/less/relative-urls/urls.less +1 -0
  92. package/test/browser/less/urls.less +1 -0
  93. package/test/browser/runner-browser-options.js +23 -23
  94. package/test/browser/runner-errors-options.js +0 -1
  95. package/test/browser/runner-errors-spec.js +1 -2
  96. package/test/browser/runner-global-vars-spec.js +1 -1
  97. package/test/browser/runner-legacy-options.js +0 -1
  98. package/test/browser/runner-main-options.js +5 -5
  99. package/test/browser/runner-main-spec.js +1 -1
  100. package/test/browser/runner-no-js-errors-spec.js +0 -1
  101. package/test/browser/runner-production-options.js +0 -1
  102. package/test/browser/runner-relative-urls-options.js +0 -1
  103. package/test/browser/runner-rootpath-options.js +0 -1
  104. package/test/browser/runner-rootpath-relative-options.js +0 -1
  105. package/test/browser/runner-strict-units-options.js +0 -1
  106. package/test/copy-bom.js +72 -0
  107. package/test/css/comments.css +1 -0
  108. package/test/css/css-3.css +2 -0
  109. package/test/css/functions.css +10 -0
  110. package/test/css/import-interpolation.css +7 -0
  111. package/test/css/import-reference.css +25 -0
  112. package/test/css/include-path/include-path.css +6 -0
  113. package/test/css/mixins-important.css +12 -0
  114. package/test/css/selectors.css +15 -1
  115. package/test/css/static-urls/urls.css +1 -0
  116. package/test/css/url-args/urls.css +3 -3
  117. package/test/css/urls.css +13 -4
  118. package/test/css/variables.css +7 -1
  119. package/test/data/image.svg +3 -0
  120. package/test/index.js +15 -10
  121. package/test/less/comments.less +1 -0
  122. package/test/less/css-3.less +3 -0
  123. package/test/less/css-guards.less +2 -1
  124. package/test/less/errors/detached-ruleset-2.txt +1 -1
  125. package/test/less/errors/import-missing.txt +1 -1
  126. package/test/less/errors/parens-error-1.txt +1 -1
  127. package/test/less/errors/parens-error-2.txt +1 -1
  128. package/test/less/errors/parens-error-3.txt +1 -1
  129. package/test/less/errors/single-character.less +1 -0
  130. package/test/less/errors/single-character.txt +2 -0
  131. package/test/less/functions.less +18 -0
  132. package/test/less/import/import-interpolation.less +1 -0
  133. package/test/less/import/import-reference.less +38 -0
  134. package/test/less/import/imports/logo.less +1 -0
  135. package/test/less/import-reference.less +3 -1
  136. package/test/less/import.less +2 -0
  137. package/test/less/include-path/include-path.less +6 -0
  138. package/test/less/mixins-important.less +28 -0
  139. package/test/less/nested-gradient-with-svg-gradient/mixin-consumer.less +5 -0
  140. package/test/less/nested-gradient-with-svg-gradient/svg-gradient-mixin.less +15 -0
  141. package/test/less/selectors.less +29 -4
  142. package/test/less/sourcemaps-empty/empty.less +0 -0
  143. package/test/less/sourcemaps-empty/var-defs.less +1 -0
  144. package/test/less/urls.less +10 -1
  145. package/test/less/variables.less +17 -3
  146. package/test/less-test.js +133 -52
  147. package/test/modify-vars.js +14 -12
  148. package/test/browser/less.js +0 -9473
package/.jscsrc ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "disallowImplicitTypeConversion": ["numeric", "boolean", "binary", "string"],
3
+ "disallowKeywords": ["with"],
4
+ "disallowMixedSpacesAndTabs": true,
5
+ "disallowMultipleLineBreaks": true,
6
+ "disallowOperatorBeforeLineBreak": ["."],
7
+ "disallowSpaceAfterKeywords": [
8
+ "void"//,
9
+ //"typeof"
10
+ ],
11
+ "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"],
12
+ "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
13
+ "disallowSpacesInCallExpression": true,
14
+ "disallowSpacesInNamedFunctionExpression": {
15
+ "beforeOpeningRoundBrace": true},
16
+ "disallowTrailingComma": true,
17
+ "disallowTrailingWhitespace": true,
18
+ "maximumLineLength": 160,
19
+ "requireCommaBeforeLineBreak": true,
20
+ "requireCurlyBraces": [ "if",
21
+ "else",
22
+ "for",
23
+ "while",
24
+ "do",
25
+ "try",
26
+ "catch"],
27
+ "requireOperatorBeforeLineBreak": [ "?",
28
+ "=",
29
+ "+",
30
+ "-",
31
+ "/",
32
+ "*",
33
+ "==",
34
+ "===",
35
+ "!=",
36
+ "!==",
37
+ ">",
38
+ ">=",
39
+ "<",
40
+ "<="],
41
+ "requireSpaceAfterBinaryOperators": true,
42
+ "requireSpaceAfterKeywords": [
43
+ "else",
44
+ "case",
45
+ "try",
46
+ "typeof",
47
+ "return",
48
+ "if",
49
+ "for",
50
+ "while",
51
+ "do"
52
+ ],
53
+ "requireSpaceBeforeBlockStatements": true,
54
+ "requireSpaceBeforeBinaryOperators": [
55
+ "=",
56
+ "+",
57
+ "-",
58
+ "/",
59
+ "*",
60
+ "==",
61
+ "===",
62
+ "!=",
63
+ "!=="
64
+ ],
65
+ "requireSpaceBeforeBlockStatements": true,
66
+ "requireSpaceBetweenArguments": true,
67
+ "requireSpacesInConditionalExpression": true,
68
+ "requireSpacesInForStatement": true,
69
+ "requireSpacesInNamedFunctionExpression": {
70
+ "beforeOpeningCurlyBrace": true
71
+ },
72
+ "validateIndentation": 4
73
+ }
package/.jshintrc CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "evil": true,
3
- "laxbreak": true,
4
3
  "latedef": true,
5
4
  "node": true,
6
5
  "undef": true,
7
6
  "unused": "vars",
8
- "trailing": true,
9
7
  "noarg": true,
10
8
  "eqnull": true,
11
9
  "forin": true,
package/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  language: node_js
2
2
  node_js:
3
+ - "0.12"
3
4
  - "0.11"
4
5
  - "0.10"
5
6
  install:
package/CHANGELOG.md CHANGED
@@ -1,3 +1,62 @@
1
+ # 2.4.0
2
+
3
+ 2015-02-07
4
+
5
+ - Support for plugins that pre-process (to add libraries silently etc.)
6
+ - Empty sourcemaps now work
7
+ - Extract and Length functions now ignore comments in a list (more work to come to fix the general problem)
8
+ - fragment url's are treated absolute since they refer to the html document
9
+ - Extends on a selector joined with `&` now work better
10
+ - Nested mixins work better with !important (regression in 2.3.0)
11
+ - The promise dependency is now actually optional (introduced in 2.0.0)
12
+ - Files with just `\r` newlines now process ok (regression in 2.0.0)
13
+ - When strict units is off and the unit is 1/x, (e.g. 1 / 12px) the unit output is x, previously nothing (regression in 2.0.0)
14
+
15
+ # 2.3.1
16
+
17
+ 2015-01-28
18
+
19
+ - Fix depends option (regression in 2.3.0)
20
+ - Support parent selector (`&`) used in sub element expression (e.g. `:not(.c_&)`)
21
+
22
+ # 2.3.0
23
+
24
+ 2015-01-27
25
+
26
+ - add isruleset function
27
+ - add optional import option, causing less to not fail if file not found
28
+ - Fix browsers-side cache.
29
+ - Many fixes to import reference - support `@support` and keyframe
30
+ - Selectors now interpolate pseudo selectors (e.g. `:@{hover}`)
31
+ - Fix comments missed off if they were at the end of the file
32
+ - Fix !important used with parametric mixins
33
+ - Emits warnings for extends when the target is not found
34
+ - include-path now works on data-uri
35
+ - variables and function calls work for path in data-uri
36
+ - Fix absolute paths not working on imports sometimes.
37
+ - Unicode BOM removed again
38
+ - Misc. bug fixes
39
+
40
+ # 2.2.0
41
+
42
+ 2015-01-04
43
+
44
+ - do not apply relative paths to svg-gradient and data-uri functions data-uri output
45
+ - using import filename interpolation and import inline together now works
46
+ - deprecate the compression option (still works, but outputs a warning unless silent)
47
+ - The node version of less now has image-size, image-width, image-height which return the image dimensions of a file
48
+ - Fixed an issue that could cause the parse to occur more than once and the callback be called multiple times
49
+ - if you are outputting to the console, lessc defaults to silent so warnings do not end up in output
50
+ - isunit function supports '' to test if a dimension has no unit
51
+ - data-uri function now counts characters after base64 encoding instead of bytes before encoding to determine ie8 support
52
+ - fix bug effecting guards on pseudo class selectors
53
+ - do not cache on the browser when used with modifyVars
54
+ - detection if less does not parse last character in file
55
+ - detection of whether a file is css now requires /css, .css, ?css, &css instead of just css. You can still tell less the type of file using import options.
56
+ - remove extra new line added to sourcemap entry inline file
57
+ - support safari extension
58
+ - less.parse now exposes a way to get the AST. We do not recommend you use this unless you need to.
59
+
1
60
  # 2.1.2
2
61
 
3
62
  2014-12-20
package/Gruntfile.js CHANGED
@@ -6,6 +6,8 @@ module.exports = function (grunt) {
6
6
  // Report the elapsed execution time of tasks.
7
7
  require('time-grunt')(grunt);
8
8
 
9
+ var COMPRESS_FOR_TESTS = true;
10
+
9
11
  // Project configuration.
10
12
  grunt.initConfig({
11
13
 
@@ -63,7 +65,7 @@ module.exports = function (grunt) {
63
65
  banner: '<%= meta.banner %>'
64
66
  },
65
67
  browsertest: {
66
- src: '<%= browserify.browser.dest %>',
68
+ src: COMPRESS_FOR_TESTS ? '<%= uglify.test.dest %>' : '<%= browserify.browser.dest %>',
67
69
  dest: 'test/browser/less.js'
68
70
  },
69
71
  dist: {
@@ -93,11 +95,18 @@ module.exports = function (grunt) {
93
95
  uglify: {
94
96
  options: {
95
97
  banner: '<%= meta.banner %>',
96
- mangle: true
98
+ mangle: true,
99
+ compress: {
100
+ pure_getters: true
101
+ }
97
102
  },
98
103
  dist: {
99
104
  src: ['<%= concat.dist.dest %>'],
100
105
  dest: 'dist/less.min.js'
106
+ },
107
+ test: {
108
+ src: '<%= browserify.browser.dest %>',
109
+ dest: 'tmp/less.min.js'
101
110
  }
102
111
  },
103
112
 
@@ -115,6 +124,13 @@ module.exports = function (grunt) {
115
124
  }
116
125
  },
117
126
 
127
+ jscs: {
128
+ src: ["test/**/*.js", "lib/less*/**/*.js", "bin/lessc"],
129
+ options: {
130
+ config: ".jscsrc"
131
+ }
132
+ },
133
+
118
134
  connect: {
119
135
  server: {
120
136
  options: {
@@ -297,7 +313,7 @@ module.exports = function (grunt) {
297
313
 
298
314
  // Clean the version of less built for the tests
299
315
  clean: {
300
- test: ['test/browser/less.js', 'tmp'],
316
+ test: ['test/browser/less.js', 'tmp', 'test/less-bom'],
301
317
  "sourcemap-test": ['test/sourcemaps/*.css', 'test/sourcemaps/*.map'],
302
318
  sauce_log: ["sc_*.log"]
303
319
  }
@@ -338,6 +354,7 @@ module.exports = function (grunt) {
338
354
  // Create the browser version of less.js
339
355
  grunt.registerTask('browsertest-lessjs', [
340
356
  'browserify:browser',
357
+ 'uglify:test',
341
358
  'concat:browsertest'
342
359
  ]);
343
360
 
@@ -355,6 +372,20 @@ module.exports = function (grunt) {
355
372
  'connect::keepalive'
356
373
  ]);
357
374
 
375
+ var previous_force_state = grunt.option("force");
376
+
377
+ grunt.registerTask("force",function(set) {
378
+ if (set === "on") {
379
+ grunt.option("force",true);
380
+ }
381
+ else if (set === "off") {
382
+ grunt.option("force",false);
383
+ }
384
+ else if (set === "restore") {
385
+ grunt.option("force",previous_force_state);
386
+ }
387
+ });
388
+
358
389
  grunt.registerTask('sauce', [
359
390
  'browsertest-lessjs',
360
391
  'jasmine::build',
@@ -371,6 +402,7 @@ module.exports = function (grunt) {
371
402
  var testTasks = [
372
403
  'clean',
373
404
  'jshint',
405
+ 'jscs',
374
406
  'shell:test',
375
407
  'browsertest'
376
408
  ];
@@ -378,7 +410,9 @@ module.exports = function (grunt) {
378
410
  if (isNaN(Number(process.env.TRAVIS_PULL_REQUEST, 10)) &&
379
411
  Number(process.env.TRAVIS_NODE_VERSION) === 0.11 &&
380
412
  (process.env.TRAVIS_BRANCH === "master" || process.env.TRAVIS_BRANCH === "sauce")) {
413
+ testTasks.push("force:on");
381
414
  testTasks.push("sauce-after-setup");
415
+ testTasks.push("force:off");
382
416
  }
383
417
 
384
418
  // Run all tests
package/appveyor.yml CHANGED
@@ -3,6 +3,7 @@ environment:
3
3
  matrix:
4
4
  - nodejs_version: "0.10"
5
5
  - nodejs_version: "0.11"
6
+ - nodejs_version: "0.12"
6
7
 
7
8
  # Allow failing jobs for bleeding-edge Node.js versions.
8
9
  matrix:
@@ -13,6 +14,10 @@ matrix:
13
14
  install:
14
15
  # Get the latest stable version of Node 0.STABLE.latest
15
16
  - ps: Install-Product node $env:nodejs_version
17
+ # Use npm v2
18
+ - npm -g install npm@2
19
+ - set PATH=%APPDATA%\npm;%PATH%
20
+ - npm -v
16
21
  # Typical npm stuff.
17
22
  - npm install
18
23
  # Grunt-specific stuff.