esvg 4.2.5 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 090e8ae35b7794a277519a8430f4bc713f570e03
4
- data.tar.gz: acc98374a8c3a8c3f67e97158a59e3d5e532bde4
3
+ metadata.gz: 3215d01408d6127b3827a4514024675e5e45f46c
4
+ data.tar.gz: 8b1a528f475f4cf98e2c674d8b25f57643906f41
5
5
  SHA512:
6
- metadata.gz: a7d301d33ccb35f27b5167b3b85d2c6538f85bde71e5cbe7b8a0f1d0d1597e8e44d65f1ee634434b52cf1767c4694b8353e0514a6c1120281e4febe9e0a4ab84
7
- data.tar.gz: 08c58866f0f855ca1244815f17389c0cf82dd8cdf8db4113a4aedd90c9a2174acd9deefb97b46af57a31d22040af9474b36699d40112a597c17d00f151290275
6
+ metadata.gz: 915d328c730f351de449eab23ac219f8b2ec9aef6df69f05656a5fc020de9c9c62c9a6bcab5a2c68fb5bcecd893d54888a808c42191669e33811a4d74d17461b
7
+ data.tar.gz: 7a65f080943ddd4d367b02474ecc0087f8246faa452973e7f1a37fbc10eab47daec0dfc3de0a710a18df6ef8df3e207829b48284c978f20cb046912e512937b4
data/lib/esvg/symbol.rb CHANGED
@@ -139,6 +139,7 @@ module Esvg
139
139
 
140
140
  @optimized = @content
141
141
  sub_def_ids
142
+ move_defs
142
143
 
143
144
  if svgo?
144
145
  response = Open3.capture3(%Q{#{Esvg.node_module('svgo')} --disable=removeUselessDefs -s '#{@optimized}' -o -})
@@ -283,5 +284,13 @@ module Esvg
283
284
  end
284
285
  end
285
286
  end
287
+
288
+ # <defs> should be moved to the beginning of the SVG file for braod browser support. Ahem, Firefox ಠ_ಠ
289
+ def move_defs
290
+ if defs = @optimized.scan(/(\s*<defs>.+<\/defs>\s*)/m).flatten[0]
291
+ @optimized.sub!(defs, '')
292
+ @optimized.sub!(/(<svg.+?>)/, "\1#{defs}")
293
+ end
294
+ end
286
295
  end
287
296
  end
data/lib/esvg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "4.2.5"
2
+ VERSION = "4.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esvg
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.5
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis