From 241b9d23a4b240eb420ef8ddad3624bf9b1ce68f Mon Sep 17 00:00:00 2001 From: Dustin Cass Date: Wed, 22 Aug 2012 11:38:29 -0700 Subject: [PATCH] Remove spaces around slashes in final CSS output and update tests to reflect that; Added a couple shorthand tests --- lib/less/parser.js | 2 +- test/css/css-3.css | 12 ++++++------ test/css/css.css | 11 +++++++---- test/css/media.css | 4 ++-- test/css/parens.css | 2 +- test/less/css.less | 5 ++++- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/lib/less/parser.js b/lib/less/parser.js index 8f4c424c..ce196d14 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -430,7 +430,7 @@ less.Parser = function Parser(env) { } else if (options.compress) { return css.replace(/(\s)+/g, "$1"); } else { - return css; + return css.replace(/\s+(\/)\s+/g, "$1"); } }; })(root.eval); diff --git a/test/css/css-3.css b/test/css/css-3.css index 1efaa536..d48dbe5a 100644 --- a/test/css/css-3.css +++ b/test/css/css-3.css @@ -73,12 +73,12 @@ p::before { } } .units { - font: 1.2rem / 2rem; - font: 8vw / 9vw; - font: 10vh / 12vh; - font: 12vm / 15vm; - font: 12vmin / 15vmin; - font: 1.2ch / 1.5ch; + font: 1.2rem/2rem; + font: 8vw/9vw; + font: 10vh/12vh; + font: 12vm/15vm; + font: 12vmin/15vmin; + font: 1.2ch/1.5ch; } @supports ( box-shadow: 2px 2px 2px black ) or ( -moz-box-shadow: 2px 2px 2px black ) { diff --git a/test/css/css.css b/test/css/css.css index 2b9607da..00d869f6 100644 --- a/test/css/css.css +++ b/test/css/css.css @@ -50,16 +50,19 @@ p + h1 { } #shorthands { border: 1px solid #000; - font: 12px / 16px Arial; - font: 100% / 16px Arial; + font: 12px/16px Arial; + font: 100%/16px Arial; margin: 1px 0; padding: 0 auto; } #more-shorthands { margin: 0; padding: 1px 0 2px 0; - font: normal small / 20px 'Trebuchet MS', Verdana, sans-serif; - font: 0 / 0 a; + font: normal small/20px 'Trebuchet MS', Verdana, sans-serif; + font: 0/0 a; + border-radius: 5px/10px; + background: url("img.jpg") center/100px; + background: #ffffff url(image.png) center/1px 100px repeat-x scroll content-box padding-box; } .misc { -moz-border-radius: 2px; diff --git a/test/css/media.css b/test/css/media.css index eba937ca..10d7a8a6 100644 --- a/test/css/media.css +++ b/test/css/media.css @@ -15,7 +15,7 @@ max-width: 480; } } -@media all and (device-aspect-ratio: 16 / 9) { +@media all and (device-aspect-ratio: 16/9) { body { max-width: 800px; } @@ -169,7 +169,7 @@ } } } -@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2 / 1), (min-resolution: 2dppx), (min-resolution: 128dpcm) { +@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-resolution: 2dppx), (min-resolution: 128dpcm) { .b { background: red; } diff --git a/test/css/parens.css b/test/css/parens.css index 34c0abac..71d3d0d5 100644 --- a/test/css/parens.css +++ b/test/css/parens.css @@ -9,7 +9,7 @@ width: 96; height: 113; margin: 12; - border-radius: 8px / 7px; + border-radius: 8px/7px; } .nested-parens { width: 71; diff --git a/test/less/css.less b/test/less/css.less index afeebb3f..d8db4991 100644 --- a/test/less/css.less +++ b/test/less/css.less @@ -65,8 +65,11 @@ p + h1 { #more-shorthands { margin: 0; padding: 1px 0 2px 0; - font: normal small/20px 'Trebuchet MS', Verdana, sans-serif; + font: normal small/20px 'Trebuchet MS', Verdana, sans-serif; font: 0/0 a; + border-radius: 5px / 10px; + background: url("img.jpg") center / 100px; + background: #fff url(image.png) center / 1px 100px repeat-x scroll content-box padding-box; } .misc {