esvg 4.1.1 → 4.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/esvg/svg.rb +4 -3
- data/lib/esvg/symbols.rb +10 -0
- data/lib/esvg/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9fdbb78002cc2514c00fb6dbff29b2dd59c0e08
|
4
|
+
data.tar.gz: fd7dd209964226bf4a7c9ec90431f68eca9ae94e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a5c58dd0ec3a9c2b2f287ce96cf0fecb967bd70a381a3570b4c56d9fd4ecf806ece2efa67024214fd1edf9fb231335ddf91903dc651f68a3c84939f5c54befd
|
7
|
+
data.tar.gz: 630f7341d55747c4e68e40b9ddbea1ed30815c6c33f91f0ba31c6b2ff529895c7e6f2eb756c454eee7ae035424b32d638b2a16de54ac7fa1982d47a0bce7d87d
|
data/lib/esvg/svg.rb
CHANGED
@@ -108,6 +108,7 @@ module Esvg
|
|
108
108
|
|
109
109
|
# Name may have changed due to flatten config
|
110
110
|
svgs[key][:name] = file_name(path)
|
111
|
+
svgs[key][:attr][:name] = id(svgs[key][:name])
|
111
112
|
|
112
113
|
dirs[dkey] ||= {}
|
113
114
|
(dirs[dkey][:files] ||= []) << key
|
@@ -450,7 +451,7 @@ module Esvg
|
|
450
451
|
if ( !names ) {
|
451
452
|
names = {}
|
452
453
|
for( var symbol of document.querySelectorAll( 'svg[id^=esvg] symbol' ) ) {
|
453
|
-
names[symbol.
|
454
|
+
names[symbol.getAttribute('name')] = symbol
|
454
455
|
}
|
455
456
|
}
|
456
457
|
return names
|
@@ -548,12 +549,12 @@ module Esvg
|
|
548
549
|
reg = %w(xmlns xmlns:xlink xml:space version).map { |m| "#{m}=\".+?\"" }.join('|')
|
549
550
|
svg.gsub(Regexp.new(reg), '') # Remove unwanted attributes
|
550
551
|
.gsub(/<?.+\?>/,'').gsub(/<!.+?>/,'') # Get rid of doctypes and comments
|
552
|
+
.gsub(/style="([^"]*?)fill:(.+?);/m, 'fill="\2" style="\1') # Make fill a property instead of a style
|
553
|
+
.gsub(/style="([^"]*?)fill-opacity:(.+?);/m, 'fill-opacity="\2" style="\1') # Move fill-opacity a property instead of a style
|
551
554
|
.gsub(/\n/, '') # Remove endlines
|
552
555
|
.gsub(/\s{2,}/, ' ') # Remove whitespace
|
553
556
|
.gsub(/>\s+</, '><') # Remove whitespace between tags
|
554
557
|
.gsub(/\s?fill="(#0{3,6}|black|rgba?\(0,0,0\))"/,'') # Strip black fill
|
555
|
-
.gsub(/style="([^"]*?)fill:(.+?);/m, 'fill="\2" style="\1') # Make fill a property instead of a style
|
556
|
-
.gsub(/style="([^"]*?)fill-opacity:(.+?);/m, 'fill-opacity="\2" style="\1') # Move fill-opacity a property instead of a style
|
557
558
|
end
|
558
559
|
|
559
560
|
def post_optimize(svg)
|
data/lib/esvg/symbols.rb
ADDED
data/lib/esvg/version.rb
CHANGED
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.1.
|
4
|
+
version: 4.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/esvg/helpers.rb
|
91
91
|
- lib/esvg/railties.rb
|
92
92
|
- lib/esvg/svg.rb
|
93
|
+
- lib/esvg/symbols.rb
|
93
94
|
- lib/esvg/version.rb
|
94
95
|
homepage: https://github.com/imathis/esvg
|
95
96
|
licenses:
|