sprockets-media_query_combiner 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,15 +10,15 @@ module Sprockets
10
10
  queries = Hash.new { |hash, key| hash[key] = '' }
11
11
  pretty = true
12
12
 
13
- filtered_data = data.gsub(/(?<query>\n?@media[^{]+){(?<body>(?<braces>(?:[^{}]+)|({\g<braces>}))*)}\n?/m) do |match|
13
+ filtered_data = data.gsub(/\n?(?<query>@media[^{]+){(?<body>(?<braces>(?:[^{}]+)|({\g<braces>}))*)}\n?/m) do |match|
14
14
  queries[$1] << $2
15
15
  pretty &&= /\n$/m === match
16
16
  ''
17
17
  end
18
18
 
19
19
  combined = queries.map { |query, body| "#{query}{#{body}}" }.
20
- join(("\n" if pretty))
21
- "#{filtered_data}#{combined}\n"
20
+ join(("\n\n" if pretty))
21
+ "#{filtered_data}#{"\n" if pretty}#{combined}\n"
22
22
  end
23
23
  end
24
24
  end
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module MediaQueryCombiner
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -21,7 +21,6 @@ h3 {
21
21
  color: black
22
22
  }
23
23
  }
24
-
25
24
  @media (max-width: 480px) {
26
25
  h2 {
27
26
  color: blue
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-media_query_combiner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-21 00:00:00.000000000 Z
12
+ date: 2012-10-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sprockets