Permalink
Browse files

Fix bug in compressed output of SCSS selectors with newlines.

Closes GH-275.
  • Loading branch information...
1 parent cd8256c commit aab0567f6f7760061fc43caa7a2e8931153f0083 @chriseppstein chriseppstein committed Sep 21, 2010
Showing with 15 additions and 1 deletion.
  1. +1 −1 lib/sass/tree/rule_node.rb
  2. +14 −0 test/sass/scss/scss_test.rb
View
2 lib/sass/tree/rule_node.rb
@@ -134,7 +134,7 @@ def _to_s(tabs)
per_rule_indent, total_indent = [:nested, :expanded].include?(style) ? [rule_indent, ''] : ['', rule_indent]
total_rule = total_indent + resolved_rules.members.
- map {|seq| seq.to_a.join}.
+ map {|seq| seq.to_a.join.tr("\n", style == :compressed ? " " : "\n")}.
join(rule_separator).split("\n").map do |line|
per_rule_indent + line.strip
end.join(line_separator)
View
14 test/sass/scss/scss_test.rb
@@ -1071,4 +1071,18 @@ def test_interpolation
ul li\#{$bar} a span.label { foo: bar; }
SCSS
end
+
+ def test_bug_275
+ assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
+z a,z b{display:block}
+CSS
+a,
+b {
+ z & {
+ display: block;
+ }
+}
+SCSS
+
+ end
end

0 comments on commit aab0567

Please sign in to comment.