less 1.2.21 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/.gitignore +4 -3
  2. data/.gitmodules +6 -0
  3. data/Gemfile +3 -0
  4. data/README.md +39 -46
  5. data/Rakefile +5 -50
  6. data/bin/lessc +1 -100
  7. data/less.gemspec +21 -125
  8. data/lib/less.rb +11 -30
  9. data/{LICENSE → lib/less/js/LICENSE} +1 -1
  10. data/lib/less/js/Makefile +56 -0
  11. data/lib/less/js/README.md +20 -0
  12. data/lib/less/js/benchmark/benchmark.less +3979 -0
  13. data/lib/less/js/benchmark/less-benchmark.js +49 -0
  14. data/lib/less/js/bin/lessc +105 -0
  15. data/lib/less/js/build/ecma-5.js +120 -0
  16. data/lib/less/js/build/header.js +7 -0
  17. data/lib/less/js/build/require.js +7 -0
  18. data/lib/less/js/dist/less-1.0.44.js +2655 -0
  19. data/lib/less/js/dist/less-1.1.0.js +2695 -0
  20. data/lib/less/js/dist/less-1.1.0.min.js +16 -0
  21. data/lib/less/js/dist/less-1.1.1.js +2710 -0
  22. data/lib/less/js/dist/less-1.1.1.min.js +16 -0
  23. data/lib/less/js/dist/less-1.1.2.js +2712 -0
  24. data/lib/less/js/dist/less-1.1.2.min.js +16 -0
  25. data/lib/less/js/dist/less-1.1.3.js +2721 -0
  26. data/lib/less/js/dist/less-1.1.3.min.js +16 -0
  27. data/lib/less/js/lib/less/browser.js +369 -0
  28. data/lib/less/js/lib/less/functions.js +174 -0
  29. data/lib/less/js/lib/less/index.js +137 -0
  30. data/lib/less/js/lib/less/parser.js +1098 -0
  31. data/lib/less/js/lib/less/tree.js +13 -0
  32. data/lib/less/js/lib/less/tree/alpha.js +17 -0
  33. data/lib/less/js/lib/less/tree/anonymous.js +13 -0
  34. data/lib/less/js/lib/less/tree/call.js +45 -0
  35. data/lib/less/js/lib/less/tree/color.js +98 -0
  36. data/lib/less/js/lib/less/tree/comment.js +14 -0
  37. data/lib/less/js/lib/less/tree/dimension.js +34 -0
  38. data/lib/less/js/lib/less/tree/directive.js +33 -0
  39. data/lib/less/js/lib/less/tree/element.js +32 -0
  40. data/lib/less/js/lib/less/tree/expression.js +23 -0
  41. data/lib/less/js/lib/less/tree/import.js +77 -0
  42. data/lib/less/js/lib/less/tree/javascript.js +51 -0
  43. data/lib/less/js/lib/less/tree/keyword.js +9 -0
  44. data/lib/less/js/lib/less/tree/mixin.js +106 -0
  45. data/lib/less/js/lib/less/tree/operation.js +32 -0
  46. data/lib/less/js/lib/less/tree/quoted.js +29 -0
  47. data/lib/less/js/lib/less/tree/rule.js +38 -0
  48. data/lib/less/js/lib/less/tree/ruleset.js +179 -0
  49. data/lib/less/js/lib/less/tree/selector.js +28 -0
  50. data/lib/less/js/lib/less/tree/url.js +25 -0
  51. data/lib/less/js/lib/less/tree/value.js +24 -0
  52. data/lib/less/js/lib/less/tree/variable.js +24 -0
  53. data/lib/less/js/package.json +13 -0
  54. data/lib/less/js/test/css/colors.css +42 -0
  55. data/lib/less/js/test/css/comments.css +52 -0
  56. data/lib/less/js/test/css/css-3.css +42 -0
  57. data/lib/less/js/test/css/css-escapes.css +20 -0
  58. data/lib/less/js/test/css/css.css +82 -0
  59. data/lib/less/js/test/css/functions.css +30 -0
  60. data/{spec → lib/less/js/test}/css/import.css +4 -2
  61. data/lib/less/js/test/css/javascript.css +22 -0
  62. data/lib/less/js/test/css/lazy-eval.css +3 -0
  63. data/lib/less/js/test/css/media.css +21 -0
  64. data/lib/less/js/test/css/mixins-args.css +61 -0
  65. data/lib/less/js/test/css/mixins-closure.css +9 -0
  66. data/lib/less/js/test/css/mixins-nested.css +14 -0
  67. data/lib/less/js/test/css/mixins-pattern.css +49 -0
  68. data/lib/less/js/test/css/mixins.css +50 -0
  69. data/{spec → lib/less/js/test}/css/operations.css +20 -2
  70. data/{spec → lib/less/js/test}/css/parens.css +0 -0
  71. data/lib/less/js/test/css/rulesets.css +29 -0
  72. data/{spec → lib/less/js/test}/css/scope.css +6 -2
  73. data/lib/less/js/test/css/selectors.css +32 -0
  74. data/lib/less/js/test/css/strings.css +38 -0
  75. data/lib/less/js/test/css/variables.css +24 -0
  76. data/lib/less/js/test/css/whitespace.css +36 -0
  77. data/lib/less/js/test/less-test.js +75 -0
  78. data/{spec → lib/less/js/test}/less/colors.less +13 -2
  79. data/{spec → lib/less/js/test}/less/comments.less +19 -2
  80. data/{spec → lib/less/js/test}/less/css-3.less +4 -1
  81. data/lib/less/js/test/less/css-escapes.less +28 -0
  82. data/{spec → lib/less/js/test}/less/css.less +10 -18
  83. data/lib/less/js/test/less/functions.less +35 -0
  84. data/{spec → lib/less/js/test}/less/import.less +1 -1
  85. data/{spec → lib/less/js/test}/less/import/import-test-a.less +0 -0
  86. data/{spec → lib/less/js/test}/less/import/import-test-b.less +0 -0
  87. data/{spec → lib/less/js/test}/less/import/import-test-c.less +0 -0
  88. data/{spec → lib/less/js/test}/less/import/import-test-d.css +0 -0
  89. data/lib/less/js/test/less/javascript.less +27 -0
  90. data/{spec → lib/less/js/test}/less/lazy-eval.less +0 -0
  91. data/lib/less/js/test/less/media.less +25 -0
  92. data/lib/less/js/test/less/mixins-args.less +118 -0
  93. data/lib/less/js/test/less/mixins-closure.less +26 -0
  94. data/lib/less/js/test/less/mixins-nested.less +22 -0
  95. data/lib/less/js/test/less/mixins-pattern.less +96 -0
  96. data/{spec → lib/less/js/test}/less/mixins.less +8 -4
  97. data/{spec → lib/less/js/test}/less/operations.less +19 -0
  98. data/{spec → lib/less/js/test}/less/parens.less +0 -0
  99. data/{spec → lib/less/js/test}/less/rulesets.less +2 -2
  100. data/{spec → lib/less/js/test}/less/scope.less +1 -1
  101. data/{spec → lib/less/js/test}/less/selectors.less +1 -1
  102. data/lib/less/js/test/less/strings.less +49 -0
  103. data/lib/less/js/test/less/variables.less +50 -0
  104. data/{spec → lib/less/js/test}/less/whitespace.less +3 -0
  105. data/lib/less/loader.rb +67 -0
  106. data/lib/less/parser.rb +46 -0
  107. data/lib/less/version.rb +3 -0
  108. data/spec/less/one/one.less +1 -0
  109. data/spec/less/parser_spec.rb +30 -0
  110. data/spec/less/two/two.less +1 -0
  111. data/spec/spec_helper.rb +2 -7
  112. metadata +156 -106
  113. data/CHANGELOG +0 -62
  114. data/VERSION +0 -1
  115. data/lib/less/command.rb +0 -110
  116. data/lib/less/engine.rb +0 -52
  117. data/lib/less/engine/grammar/common.tt +0 -29
  118. data/lib/less/engine/grammar/entity.tt +0 -144
  119. data/lib/less/engine/grammar/less.tt +0 -341
  120. data/lib/less/engine/nodes.rb +0 -9
  121. data/lib/less/engine/nodes/element.rb +0 -281
  122. data/lib/less/engine/nodes/entity.rb +0 -79
  123. data/lib/less/engine/nodes/function.rb +0 -93
  124. data/lib/less/engine/nodes/literal.rb +0 -171
  125. data/lib/less/engine/nodes/property.rb +0 -232
  126. data/lib/less/engine/nodes/ruleset.rb +0 -12
  127. data/lib/less/engine/nodes/selector.rb +0 -44
  128. data/lib/less/ext.rb +0 -60
  129. data/spec/command_spec.rb +0 -102
  130. data/spec/css/accessors.css +0 -18
  131. data/spec/css/big.css +0 -3768
  132. data/spec/css/colors.css +0 -14
  133. data/spec/css/comments.css +0 -9
  134. data/spec/css/css-3.css +0 -21
  135. data/spec/css/css.css +0 -50
  136. data/spec/css/dash-prefix.css +0 -12
  137. data/spec/css/functions.css +0 -6
  138. data/spec/css/import-with-extra-paths.css +0 -8
  139. data/spec/css/import-with-partial-in-extra-path.css +0 -6
  140. data/spec/css/lazy-eval.css +0 -1
  141. data/spec/css/mixins-args.css +0 -32
  142. data/spec/css/mixins.css +0 -28
  143. data/spec/css/rulesets.css +0 -17
  144. data/spec/css/selectors.css +0 -13
  145. data/spec/css/strings.css +0 -12
  146. data/spec/css/variables.css +0 -8
  147. data/spec/css/whitespace.css +0 -7
  148. data/spec/engine_spec.rb +0 -127
  149. data/spec/less/accessors.less +0 -20
  150. data/spec/less/big.less +0 -1264
  151. data/spec/less/dash-prefix.less +0 -21
  152. data/spec/less/exceptions/mixed-units-error.less +0 -3
  153. data/spec/less/exceptions/name-error-1.0.less +0 -3
  154. data/spec/less/exceptions/syntax-error-1.0.less +0 -3
  155. data/spec/less/extra_import_path/extra.less +0 -1
  156. data/spec/less/extra_import_path/import/import-test-a.css +0 -1
  157. data/spec/less/extra_import_path/import/import-test-a.less +0 -4
  158. data/spec/less/functions.less +0 -6
  159. data/spec/less/hidden.less +0 -25
  160. data/spec/less/import-with-extra-paths.less +0 -4
  161. data/spec/less/literal-css.less +0 -11
  162. data/spec/less/mixins-args.less +0 -59
  163. data/spec/less/strings.less +0 -14
  164. data/spec/less/variables.less +0 -29
  165. data/spec/spec.css +0 -50
@@ -0,0 +1,24 @@
1
+ (function (tree) {
2
+
3
+ tree.Value = function (value) {
4
+ this.value = value;
5
+ this.is = 'value';
6
+ };
7
+ tree.Value.prototype = {
8
+ eval: function (env) {
9
+ if (this.value.length === 1) {
10
+ return this.value[0].eval(env);
11
+ } else {
12
+ return new(tree.Value)(this.value.map(function (v) {
13
+ return v.eval(env);
14
+ }));
15
+ }
16
+ },
17
+ toCSS: function (env) {
18
+ return this.value.map(function (e) {
19
+ return e.toCSS(env);
20
+ }).join(env.compress ? ',' : ', ');
21
+ }
22
+ };
23
+
24
+ })(require('less/tree'));
@@ -0,0 +1,24 @@
1
+ (function (tree) {
2
+
3
+ tree.Variable = function (name, index) { this.name = name, this.index = index };
4
+ tree.Variable.prototype = {
5
+ eval: function (env) {
6
+ var variable, v, name = this.name;
7
+
8
+ if (name.indexOf('@@') == 0) {
9
+ name = '@' + new(tree.Variable)(name.slice(1)).eval(env).value;
10
+ }
11
+
12
+ if (variable = tree.find(env.frames, function (frame) {
13
+ if (v = frame.variable(name)) {
14
+ return v.value.eval(env);
15
+ }
16
+ })) { return variable }
17
+ else {
18
+ throw { message: "variable " + name + " is undefined",
19
+ index: this.index };
20
+ }
21
+ }
22
+ };
23
+
24
+ })(require('less/tree'));
@@ -0,0 +1,13 @@
1
+ {
2
+ "name" : "less",
3
+ "description" : "Leaner CSS",
4
+ "url" : "http://lesscss.org",
5
+ "keywords" : ["css", "parser", "lesscss", "browser"],
6
+ "author" : "Alexis Sellier <self@cloudhead.net>",
7
+ "contributors" : [],
8
+ "version" : "1.1.3",
9
+ "bin" : { "lessc": "./bin/lessc" },
10
+ "main" : "./lib/less/index",
11
+ "directories" : { "test": "./test" },
12
+ "engines" : { "node": ">=0.2.0" }
13
+ }
@@ -0,0 +1,42 @@
1
+ #yelow #short {
2
+ color: #fea;
3
+ }
4
+ #yelow #long {
5
+ color: #ffeeaa;
6
+ }
7
+ #yelow #rgba {
8
+ color: rgba(255, 238, 170, 0.1);
9
+ }
10
+ #blue #short {
11
+ color: #00f;
12
+ }
13
+ #blue #long {
14
+ color: #0000ff;
15
+ }
16
+ #blue #rgba {
17
+ color: rgba(0, 0, 255, 0.1);
18
+ }
19
+ #alpha #hsla {
20
+ color: rgba(61, 45, 41, 0.6);
21
+ }
22
+ #overflow .a {
23
+ color: #000000;
24
+ }
25
+ #overflow .b {
26
+ color: #ffffff;
27
+ }
28
+ #overflow .c {
29
+ color: #ffffff;
30
+ }
31
+ #overflow .d {
32
+ color: #00ff00;
33
+ }
34
+ #grey {
35
+ color: #c8c8c8;
36
+ }
37
+ #808080 {
38
+ color: #808080;
39
+ }
40
+ #00ff00 {
41
+ color: #00ff00;
42
+ }
@@ -0,0 +1,52 @@
1
+ /******************\
2
+ * *
3
+ * Comment Header *
4
+ * *
5
+ \******************/
6
+ /*
7
+
8
+ Comment
9
+
10
+ */
11
+ /*
12
+ * Comment Test
13
+ *
14
+ * - cloudhead (http://cloudhead.net)
15
+ *
16
+ */
17
+ /* Colors
18
+ * ------
19
+ * #EDF8FC (background blue)
20
+ * #166C89 (darkest blue)
21
+ *
22
+ * Text:
23
+ * #333 (standard text) // A comment within a comment!
24
+ * #1F9EC9 (standard link)
25
+ *
26
+ */
27
+ /* @group Variables
28
+ ------------------- */
29
+ #comments {
30
+ /**/
31
+ color: red;
32
+ /* A C-style comment */
33
+
34
+ background-color: orange;
35
+ font-size: 12px;
36
+ /* lost comment */
37
+ content: "content";
38
+ border: 1px solid black;
39
+ padding: 0;
40
+ margin: 2em;
41
+ }
42
+ /* commented out
43
+ #more-comments {
44
+ color: grey;
45
+ }
46
+ */
47
+ .selector, .lots, .comments {
48
+ color: grey, /* blue */ orange;
49
+ }
50
+ #last {
51
+ color: blue;
52
+ }
@@ -0,0 +1,42 @@
1
+ .comma-delimited {
2
+ background: url(bg.jpg) no-repeat, url(bg.png) repeat-x top left, url(bg);
3
+ text-shadow: -1px -1px 1px red, 6px 5px 5px yellow;
4
+ -moz-box-shadow: 0pt 0pt 2px rgba(255, 255, 255, 0.4) inset, 0pt 4px 6px rgba(255, 255, 255, 0.4) inset;
5
+ }
6
+ @font-face {
7
+ font-family: Headline;
8
+ src: local(Futura-Medium), url(fonts.svg#MyGeometricModern) format("svg");
9
+ }
10
+ .other {
11
+ -moz-transform: translate(0, 11em) rotate(-90deg);
12
+ }
13
+ p:not([class*="lead"]) {
14
+ color: black;
15
+ }
16
+ input[type="text"].class#id[attr=32]:not(1) {
17
+ color: white;
18
+ }
19
+ div#id.class[a=1][b=2].class:not(1) {
20
+ color: white;
21
+ }
22
+ ul.comma > li:not(:only-child)::after {
23
+ color: white;
24
+ }
25
+ ol.comma > li:nth-last-child(2)::after {
26
+ color: white;
27
+ }
28
+ li:nth-child(4n+1), li:nth-child(-5n), li:nth-child(-n+2) {
29
+ color: white;
30
+ }
31
+ a[href^="http://"] {
32
+ color: black;
33
+ }
34
+ a[href$="http://"] {
35
+ color: black;
36
+ }
37
+ form[data-disabled] {
38
+ color: black;
39
+ }
40
+ p::before {
41
+ color: black;
42
+ }
@@ -0,0 +1,20 @@
1
+ .escape\|random\|char {
2
+ color: red;
3
+ }
4
+ .mixin\!tUp {
5
+ font-weight: bold;
6
+ }
7
+ .\34 04 {
8
+ background: red;
9
+ }
10
+ .\34 04 strong {
11
+ color: fuchsia;
12
+ font-weight: bold;
13
+ }
14
+ .trailingTest\+ {
15
+ color: red;
16
+ }
17
+ /* This hideous test of hideousness checks for the selector "blockquote" with various permutations of hex escapes */
18
+ \62\6c\6f \63 \6B \0071 \000075o\74 e {
19
+ color: silver;
20
+ }
@@ -0,0 +1,82 @@
1
+ @charset "utf-8";
2
+ div {
3
+ color: black;
4
+ }
5
+ div {
6
+ width: 99%;
7
+ }
8
+ * {
9
+ min-width: 45em;
10
+ }
11
+ h1, h2 > a > p, h3 {
12
+ color: none;
13
+ }
14
+ div.class {
15
+ color: blue;
16
+ }
17
+ div#id {
18
+ color: green;
19
+ }
20
+ .class#id {
21
+ color: purple;
22
+ }
23
+ .one.two.three {
24
+ color: grey;
25
+ }
26
+ @media print {
27
+ font-size: 3em;
28
+ }
29
+ @media screen {
30
+ font-size: 10px;
31
+ }
32
+ @font-face {
33
+ font-family: 'Garamond Pro';
34
+ src: url("/fonts/garamond-pro.ttf");
35
+ }
36
+ a:hover, a:link {
37
+ color: #999;
38
+ }
39
+ p, p:first-child {
40
+ text-transform: none;
41
+ }
42
+ q:lang(no) {
43
+ quotes: none;
44
+ }
45
+ p + h1 {
46
+ font-size: 2.2em;
47
+ }
48
+ #shorthands {
49
+ border: 1px solid #000;
50
+ font: 12px/16px Arial;
51
+ font: 100%/16px Arial;
52
+ margin: 1px 0;
53
+ padding: 0 auto;
54
+ background: url("http://www.lesscss.org/spec.html") no-repeat 0 4px;
55
+ }
56
+ #more-shorthands {
57
+ margin: 0;
58
+ padding: 1px 0 2px 0;
59
+ font: normal small/20px 'Trebuchet MS', Verdana, sans-serif;
60
+ }
61
+ .misc {
62
+ -moz-border-radius: 2px;
63
+ display: -moz-inline-stack;
64
+ width: .1em;
65
+ background-color: #009998;
66
+ background-image: url(images/image.jpg);
67
+ background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue));
68
+ margin: ;
69
+ filter: alpha(opacity=100);
70
+ }
71
+ #important {
72
+ color: red !important;
73
+ width: 100%!important;
74
+ height: 20px ! important;
75
+ }
76
+ #data-uri {
77
+ background: url(data:image/png;charset=utf-8;base64,
78
+ kiVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD/
79
+ k//+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4U
80
+ kg9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC);
81
+ background-image: url(data:image/x-png,f9difSSFIIGFIFJD1f982FSDKAA9==);
82
+ }
@@ -0,0 +1,30 @@
1
+ #functions {
2
+ color: #660000;
3
+ width: 16;
4
+ height: undefined("self");
5
+ border-width: 5;
6
+ variable: 11;
7
+ }
8
+ #built-in {
9
+ escaped: -Some::weird(#thing, y);
10
+ lighten: #ffcccc;
11
+ darken: #330000;
12
+ saturate: #203c31;
13
+ desaturate: #29332f;
14
+ greyscale: #2e2e2e;
15
+ spin-p: #bf6a40;
16
+ spin-n: #bf4055;
17
+ format: "rgb(32, 128, 64)";
18
+ format-string: "hello world";
19
+ format-multiple: "hello earth 2";
20
+ format-url-encode: "red is %23ff0000";
21
+ eformat: rgb(32, 128, 64);
22
+ hue: 98;
23
+ saturation: 12%;
24
+ lightness: 95%;
25
+ rounded: 11;
26
+ roundedpx: 3px;
27
+ }
28
+ #alpha {
29
+ alpha: rgba(153, 94, 51, 0.6);
30
+ }
@@ -1,5 +1,7 @@
1
- #css { color: yellow; }
2
- #import { color: red; }
1
+ @import "import-test-d.css";
2
+ #import {
3
+ color: red;
4
+ }
3
5
  .mixin {
4
6
  height: 10px;
5
7
  color: red;
@@ -0,0 +1,22 @@
1
+ .eval {
2
+ js: 42;
3
+ js: 2;
4
+ js: "hello world";
5
+ js: 1, 2, 3;
6
+ title: "node";
7
+ ternary: true;
8
+ }
9
+ .scope {
10
+ var: 42;
11
+ escaped: 7px;
12
+ }
13
+ .vars {
14
+ width: 8;
15
+ }
16
+ .escape-interpol {
17
+ width: hello world;
18
+ }
19
+ .arrays {
20
+ ary: "1, 2, 3";
21
+ ary: "1, 2, 3";
22
+ }
@@ -0,0 +1,3 @@
1
+ .lazy-eval {
2
+ width: 100%;
3
+ }
@@ -0,0 +1,21 @@
1
+ @media print {
2
+ .class {
3
+ color: blue;
4
+ }
5
+ .class .sub {
6
+ width: 42;
7
+ }
8
+ .top, header > h1 {
9
+ color: #444444;
10
+ }
11
+ }
12
+ @media screen {
13
+ body {
14
+ max-width: 480;
15
+ }
16
+ }
17
+ @media all and (orientation:portrait) {
18
+ aside {
19
+ float: none;
20
+ }
21
+ }
@@ -0,0 +1,61 @@
1
+ #hidden {
2
+ color: transparent;
3
+ color: transparent;
4
+ }
5
+ .two-args {
6
+ color: blue;
7
+ width: 10px;
8
+ height: 99%;
9
+ border: 2px dotted black;
10
+ }
11
+ .one-arg {
12
+ width: 15px;
13
+ height: 49%;
14
+ }
15
+ .no-parens {
16
+ width: 5px;
17
+ height: 49%;
18
+ }
19
+ .no-args {
20
+ width: 5px;
21
+ height: 49%;
22
+ }
23
+ .var-args {
24
+ width: 45;
25
+ height: 17%;
26
+ }
27
+ .multi-mix {
28
+ width: 10px;
29
+ height: 29%;
30
+ margin: 4;
31
+ padding: 5;
32
+ }
33
+ body {
34
+ padding: 30px;
35
+ color: #ff0000;
36
+ }
37
+ .scope-mix {
38
+ width: 8;
39
+ }
40
+ .content {
41
+ width: 600px;
42
+ }
43
+ .content .column {
44
+ margin: 600px;
45
+ }
46
+ #same-var-name {
47
+ radius: 5px;
48
+ }
49
+ #var-inside {
50
+ width: 10px;
51
+ }
52
+ .id-class {
53
+ color: red;
54
+ color: red;
55
+ }
56
+ .arguments {
57
+ border: 1px solid black;
58
+ }
59
+ .arguments2 {
60
+ border: 0px;
61
+ }