esvg 2.8.0 → 2.8.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +6 -0
- data/lib/esvg/svg.rb +3 -4
- data/lib/esvg/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd6726e520f6f5f2a893e95bf449bef8bdd95f02
|
4
|
+
data.tar.gz: c70c6ae44e857f5d06ebeecfcee14b641a959069
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50dcc95fd77a8fea828c6f28b8850ae8d87d80f0d00a77cfc15f743acf2122b4aa930e5e270596f4986c10fa4af53dff354390597a8f51171de3e7677cf093f2
|
7
|
+
data.tar.gz: 4906f1e08b0f91904f685512fdb11bb04a3d3b16102da1564b17cfebc95ea0c075f0b244c244242e2811b4bde7f30ac5f8e28312191df20ab6b4c9b4042ebd26
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 2.8.1 (2015-12-16)
|
4
|
+
- Fix: Repeat icons no longer retain previous icon's options.
|
5
|
+
|
3
6
|
### 2.8.0 (2015-12-16)
|
4
7
|
- New: Added exist? method to ask if an icon exists.
|
5
8
|
- New: `fallback` option allows svgs to provide a fallback icon if one is not found.
|
data/README.md
CHANGED
@@ -65,6 +65,12 @@ To place an SVG icon, use the `svg_icon` helper. This helper will embed an SVG `
|
|
65
65
|
# Output:
|
66
66
|
# <svg class="icon kitten-icon adorbs"><use xlink:href="#kitten-icon"/></svg>
|
67
67
|
|
68
|
+
# Provide fallback icon if an icon is missing
|
69
|
+
<%= svg_icon 'missing', fallback: 'kitten' %>
|
70
|
+
|
71
|
+
# Output:
|
72
|
+
# <svg class="icon kitten-icon"><use xlink:href="#kitten-icon"/></svg>
|
73
|
+
|
68
74
|
# Add custom styles
|
69
75
|
<%= svg_icon 'kitten', style: 'color: #c0ffee' %>
|
70
76
|
|
data/lib/esvg/svg.rb
CHANGED
@@ -156,14 +156,13 @@ module Esvg
|
|
156
156
|
else
|
157
157
|
|
158
158
|
embed = use_icon(file)
|
159
|
-
|
160
|
-
embed.sub!(/class="(.+?)"/, 'class="\1 '+options[:class]+'"') if options[:class]
|
159
|
+
embed = embed.sub(/class="(.+?)"/, 'class="\1 '+options[:class]+'"') if options[:class]
|
161
160
|
|
162
161
|
if options[:style]
|
163
162
|
if embed.match(/style/)
|
164
|
-
embed.sub
|
163
|
+
embed = embed.sub(/style="(.+?)"/, 'style="\1; '+options[:style]+'"')
|
165
164
|
else
|
166
|
-
embed.sub
|
165
|
+
embed = embed.sub(/><use/, %Q{ style="#{options[:style]}"><use})
|
167
166
|
end
|
168
167
|
end
|
169
168
|
|
data/lib/esvg/version.rb
CHANGED