From 905d63fd2fba9ea06ad3f7bd5e27c1b72b3329f0 Mon Sep 17 00:00:00 2001 From: Bobby Wertman Date: Mon, 21 Nov 2011 19:56:25 -0500 Subject: [PATCH 1/3] Added an AMD module registration. --- Makefile | 1 + build/amd.js | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 build/amd.js diff --git a/Makefile b/Makefile index 8baea4fa..4ad9cb0e 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,7 @@ less: @@cat ${HEADER} | sed s/@VERSION/${VERSION}/ > ${DIST} @@echo "(function (window, undefined) {" >> ${DIST} @@cat build/require.js\ + build/amd.js\ build/ecma-5.js\ ${SRC}/parser.js\ ${SRC}/functions.js\ diff --git a/build/amd.js b/build/amd.js new file mode 100644 index 00000000..c4b11870 --- /dev/null +++ b/build/amd.js @@ -0,0 +1,6 @@ +// amd.js +// +// Define Less as an AMD module. +if (typeof define === "function" && define.amd) { + define("less", [], function () { return less; } ); +} From bb5f0386156d5553e484dd2ca9ea6d61d7c355d1 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Sat, 21 Jan 2012 02:30:56 +0100 Subject: [PATCH 2/3] fix url() imports --- lib/less/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/less/parser.js b/lib/less/parser.js index 41d79f11..51c8e03f 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -1255,7 +1255,7 @@ if (less.mode === 'browser' || less.mode === 'rhino') { // Used by `@import` directives // less.Parser.importer = function (path, paths, callback, env) { - if (path.charAt(0) !== '/' && paths.length > 0) { + if (!/^([a-z]+:)?\//.test(path) && paths.length > 0) { path = paths[0] + path; } // We pass `true` as 3rd argument, to force the reload of the import. From 75419077d774d93b84edf90a7efbe4abd4373c97 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Thu, 19 Jan 2012 13:54:45 -0800 Subject: [PATCH 3/3] always newline selector lists --- lib/less/tree/ruleset.js | 3 ++- test/css/comments.css | 4 +++- test/css/css-3.css | 4 +++- test/css/css.css | 10 +++++++--- test/css/media.css | 3 ++- test/css/mixins.css | 3 ++- test/css/rulesets.css | 8 ++++++-- test/css/selectors.css | 12 ++++++++---- test/css/whitespace.css | 4 +++- 9 files changed, 36 insertions(+), 15 deletions(-) diff --git a/lib/less/tree/ruleset.js b/lib/less/tree/ruleset.js index 17bb7846..ddfe2c56 100644 --- a/lib/less/tree/ruleset.js +++ b/lib/less/tree/ruleset.js @@ -162,7 +162,8 @@ tree.Ruleset.prototype = { return p.map(function (s) { return s.toCSS(env); }).join('').trim(); - }).join(env.compress ? ',' : (paths.length > 3 ? ',\n' : ', ')); + }).join( env.compress ? ',' : ',\n'); + css.push(selector, (env.compress ? '{' : ' {\n ') + rules.join(env.compress ? '' : '\n ') + diff --git a/test/css/comments.css b/test/css/comments.css index f74687f6..352dd48e 100644 --- a/test/css/comments.css +++ b/test/css/comments.css @@ -44,7 +44,9 @@ color: grey; } */ -.selector, .lots, .comments { +.selector, +.lots, +.comments { color: #808080, /* blue */ #ffa500; -webkit-border-radius: 2px /* webkit only */; -moz-border-radius: 8px /* moz only with operation */; diff --git a/test/css/css-3.css b/test/css/css-3.css index 5ab6a7ee..45bdc40d 100644 --- a/test/css/css-3.css +++ b/test/css/css-3.css @@ -25,7 +25,9 @@ ul.comma > li:not(:only-child)::after { ol.comma > li:nth-last-child(2)::after { color: white; } -li:nth-child(4n+1), li:nth-child(-5n), li:nth-child(-n+2) { +li:nth-child(4n+1), +li:nth-child(-5n), +li:nth-child(-n+2) { color: white; } a[href^="http://"] { diff --git a/test/css/css.css b/test/css/css.css index bcac39c9..63d20ec4 100644 --- a/test/css/css.css +++ b/test/css/css.css @@ -8,7 +8,9 @@ div { * { min-width: 45em; } -h1, h2 > a > p, h3 { +h1, +h2 > a > p, +h3 { color: none; } div.class { @@ -33,10 +35,12 @@ div#id { font-family: 'Garamond Pro'; src: url("/fonts/garamond-pro.ttf"); } -a:hover, a:link { +a:hover, +a:link { color: #999; } -p, p:first-child { +p, +p:first-child { text-transform: none; } q:lang(no) { diff --git a/test/css/media.css b/test/css/media.css index d55ea367..751b179d 100644 --- a/test/css/media.css +++ b/test/css/media.css @@ -5,7 +5,8 @@ .class .sub { width: 42; } - .top, header > h1 { + .top, + header > h1 { color: #444444; } } diff --git a/test/css/mixins.css b/test/css/mixins.css index be9967f0..45d51793 100644 --- a/test/css/mixins.css +++ b/test/css/mixins.css @@ -48,7 +48,8 @@ .direct { border-style: dotted; } -.bo, .bar { +.bo, +.bar { width: 100%; } .bo { diff --git a/test/css/rulesets.css b/test/css/rulesets.css index 3e73bc0c..408c76aa 100644 --- a/test/css/rulesets.css +++ b/test/css/rulesets.css @@ -13,7 +13,9 @@ #first > .one > #second .two > #deux #third:focus #fifth > #sixth .seventh #eighth + #ninth { color: purple; } -#first > .one > #second .two > #deux #fourth, #first > .one > #second .two > #deux #five, #first > .one > #second .two > #deux #six { +#first > .one > #second .two > #deux #fourth, +#first > .one > #second .two > #deux #five, +#first > .one > #second .two > #deux #six { color: #110000; } #first > .one > #second .two > #deux #fourth .seven, @@ -24,6 +26,8 @@ #first > .one > #second .two > #deux #six .eight > #nine { border: 1px solid black; } -#first > .one > #second .two > #deux #fourth #ten, #first > .one > #second .two > #deux #five #ten, #first > .one > #second .two > #deux #six #ten { +#first > .one > #second .two > #deux #fourth #ten, +#first > .one > #second .two > #deux #five #ten, +#first > .one > #second .two > #deux #six #ten { color: red; } diff --git a/test/css/selectors.css b/test/css/selectors.css index a384f938..9ad63fd1 100644 --- a/test/css/selectors.css +++ b/test/css/selectors.css @@ -27,7 +27,8 @@ td { margin: 0; padding: 0; } -td, input { +td, +input { line-height: 1em; } a { @@ -42,12 +43,15 @@ div a { p a span { color: yellow; } -.foo .bar .qux, .foo .baz .qux { +.foo .bar .qux, +.foo .baz .qux { display: block; } -.qux .foo .bar, .qux .foo .baz { +.qux .foo .bar, +.qux .foo .baz { display: inline; } -.qux .foo .bar .biz, .qux .foo .baz .biz { +.qux .foo .bar .biz, +.qux .foo .baz .biz { display: none; } diff --git a/test/css/whitespace.css b/test/css/whitespace.css index 32979854..56e067fc 100644 --- a/test/css/whitespace.css +++ b/test/css/whitespace.css @@ -13,7 +13,9 @@ .whitespace { color: white ; } -.white, .space, .mania { +.white, +.space, +.mania { color: white; } .no-semi-column {