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(
|
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
|
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.
|
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-
|
12
|
+
date: 2012-10-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|