Removes unnecessary spaces from compact output
diff --git a/lib/src/css_printer.dart b/lib/src/css_printer.dart
index 14c1f8c..c434caf 100644
--- a/lib/src/css_printer.dart
+++ b/lib/src/css_printer.dart
@@ -29,7 +29,7 @@
/** Returns the output buffer. */
String toString() => _buff.toString().trim();
- String get _newLine => prettyPrint ? '\n' : ' ';
+ String get _newLine => prettyPrint ? '\n' : '';
String get _sp => prettyPrint ? ' ' : '';
// TODO(terry): When adding obfuscation we'll need isOptimized (compact w/
@@ -282,7 +282,7 @@
void visitRuleSet(RuleSet node) {
emit("$_newLine");
node._selectorGroup.visit(this);
- emit(" {$_newLine");
+ emit("$_sp{$_newLine");
node._declarationGroup.visit(this);
emit("}");
}
diff --git a/test/declaration_test.dart b/test/declaration_test.dart
index ab1f70d..56473cc 100644
--- a/test/declaration_test.dart
+++ b/test/declaration_test.dart
@@ -852,9 +852,15 @@
final String input = r'''
div {
color: green !important;
+ background: red blue green;
+}
+.foo p[bar] {
+ color: blue;
}
''';
- final String generated = "div { color:green!important; }";
+ final String generated =
+ 'div{color:green!important;background:red blue green;}'
+ '.foo p[bar]{color:blue;}';
var stylesheet = parseCss(input, errors: errors);