From 75419077d774d93b84edf90a7efbe4abd4373c97 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Thu, 19 Jan 2012 13:54:45 -0800 Subject: [PATCH] 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 {