Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix bug in compressed output of SCSS selectors with newlines.

Closes GH-275.
  • Loading branch information...
commit aab0567f6f7760061fc43caa7a2e8931153f0083 1 parent cd8256c
Chris Eppstein authored
2  lib/sass/tree/rule_node.rb
@@ -134,7 +134,7 @@ def _to_s(tabs)
134 134
       per_rule_indent, total_indent = [:nested, :expanded].include?(style) ? [rule_indent, ''] : ['', rule_indent]
135 135
 
136 136
       total_rule = total_indent + resolved_rules.members.
137  
-        map {|seq| seq.to_a.join}.
  137
+        map {|seq| seq.to_a.join.tr("\n", style == :compressed ? " " : "\n")}.
138 138
         join(rule_separator).split("\n").map do |line|
139 139
         per_rule_indent + line.strip
140 140
       end.join(line_separator)
14  test/sass/scss/scss_test.rb
@@ -1071,4 +1071,18 @@ def test_interpolation
1071 1071
 ul li\#{$bar} a span.label { foo: bar; }
1072 1072
 SCSS
1073 1073
   end
  1074
+
  1075
+  def test_bug_275
  1076
+    assert_equal <<CSS, render(<<SCSS, :style=>:compressed)
  1077
+z a,z b{display:block}
  1078
+CSS
  1079
+a,
  1080
+b {
  1081
+  z & {
  1082
+    display: block;
  1083
+  }
  1084
+}
  1085
+SCSS
  1086
+
  1087
+  end
1074 1088
 end

0 notes on commit aab0567

Please sign in to comment.
Something went wrong with that request. Please try again.