sass 3.2.0.alpha.273 → 3.2.0.alpha.274

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/REVISION CHANGED
@@ -1 +1 @@
1
- 9b1820a2b092ba228eb20bea33b07ddd0793146f
1
+ 0bba15c5b6c701c739c3b40b0e78c1655a27be6f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0.alpha.273
1
+ 3.2.0.alpha.274
@@ -148,7 +148,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
148
148
  end
149
149
 
150
150
  def visit_media(node)
151
- "#{tab_str}@media #{interp_to_src(node.query)}#{yield}"
151
+ "#{tab_str}@media #{media_interp_to_src(node.query)}#{yield}"
152
152
  end
153
153
 
154
154
  def visit_supports(node)
@@ -243,6 +243,22 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
243
243
  end.join
244
244
  end
245
245
 
246
+ # Like interp_to_src, but removes the unnecessary `#{}` around the keys and
247
+ # values in media expressions.
248
+ def media_interp_to_src(interp)
249
+ Sass::Util.enum_with_index(interp).map do |r, i|
250
+ next r if r.is_a?(String)
251
+ before, after = interp[i-1], interp[i+1]
252
+ if before.is_a?(String) && after.is_a?(String) &&
253
+ ((before[-1] == ?( && after[0] == ?:) ||
254
+ (before =~ /:\s*/ && after[0] == ?)))
255
+ r.to_sass(@options)
256
+ else
257
+ "\#{#{r.to_sass(@options)}}"
258
+ end
259
+ end.join
260
+ end
261
+
246
262
  def selector_to_src(sel)
247
263
  @format == :sass ? selector_to_sass(sel) : selector_to_scss(sel)
248
264
  end
@@ -1160,14 +1160,13 @@ SCSS
1160
1160
  end
1161
1161
 
1162
1162
  def test_media_with_expressions
1163
- # TODO: get rid of the #{} in the expression output
1164
1163
  assert_sass_to_scss <<SCSS, <<SASS
1165
1164
  $media1: screen;
1166
1165
  $media2: print;
1167
1166
  $var: -webkit-min-device-pixel-ratio;
1168
1167
  $val: 20;
1169
1168
 
1170
- @media \#{$media1} and (\#{$var + "-foo"}: \#{$val + 5}), only \#{$media2} {
1169
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2} {
1171
1170
  a: b;
1172
1171
  }
1173
1172
  SCSS
@@ -1186,7 +1185,7 @@ $media2: print
1186
1185
  $var: -webkit-min-device-pixel-ratio
1187
1186
  $val: 20
1188
1187
 
1189
- @media \#{$media1} and (\#{$var + "-foo"}: \#{$val + 5}), only \#{$media2}
1188
+ @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
1190
1189
  a: b
1191
1190
  SASS
1192
1191
  $media1: screen;
@@ -1565,6 +1564,16 @@ SCSS
1565
1564
 
1566
1565
  ## Regression Tests
1567
1566
 
1567
+ def test_media_query_with_expr
1568
+ assert_scss_to_sass <<SASS, <<SCSS
1569
+ @media foo and (bar: baz)
1570
+ a: b
1571
+ SASS
1572
+ @media foo and (bar: baz) {
1573
+ a: b; }
1574
+ SCSS
1575
+ end
1576
+
1568
1577
  def test_empty_lists
1569
1578
  assert_renders(<<SASS, <<SCSS)
1570
1579
  $foo: ()
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592302399
4
+ hash: 592302393
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 273
12
- version: 3.2.0.alpha.273
11
+ - 274
12
+ version: 3.2.0.alpha.274
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum
@@ -154,7 +154,6 @@ files:
154
154
  - lib/sass/tree/content_node.rb
155
155
  - lib/sass/tree/css_import_node.rb
156
156
  - lib/sass/tree/variable_node.rb
157
- - lib/sass/tree/warn_node.rb
158
157
  - lib/sass/tree/visitors/base.rb
159
158
  - lib/sass/tree/visitors/check_nesting.rb
160
159
  - lib/sass/tree/visitors/convert.rb
@@ -164,6 +163,7 @@ files:
164
163
  - lib/sass/tree/visitors/perform.rb
165
164
  - lib/sass/tree/visitors/set_options.rb
166
165
  - lib/sass/tree/visitors/to_css.rb
166
+ - lib/sass/tree/warn_node.rb
167
167
  - lib/sass/tree/while_node.rb
168
168
  - lib/sass/tree/supports_node.rb
169
169
  - lib/sass/tree/trace_node.rb