esvg 2.6.0 → 2.7.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: 8928ef2748b06a41e7ab4a9abe551d0dd16b96ba
4
- data.tar.gz: fb3310389aaa166839a767115f94d92df0919a9a
3
+ metadata.gz: fa6229774082f4aea9f199648b775df39740ceab
4
+ data.tar.gz: 0ae1d189e08fc4052453ca6a2e2a3b60e80c7824
5
5
  SHA512:
6
- metadata.gz: dad7eaffda60a40b8dd13eb9e723f9a8dd08e066494f1afc41944a5a441acb74786d65978179a505e568fe71c48d3bd13e40421b72ccae311c24abcfcc947701
7
- data.tar.gz: 4ab68f00946a4dd1503e1e1d15f4e76624114fd798bf0bcaa30c4215b1cc3d7c3ddd2b9a593a499ab1dfcefb92a9f0b480bae94efb32277cae84cbfe11523fd1
6
+ metadata.gz: fcf42cf652f2ba221b232a933a0585e63bd7b74a7cf85827f7c355735351cc7df2c5d24fdb8da1d6acef206b637e33de629687424429bc92efa89586a0f7e2c7
7
+ data.tar.gz: dfdd9c185afb48597d998fefab052bc6ba5c6dfc11ca6f7903f7566b7e6498bfc48d38f0da478653207f0eeea55eec2ef82ed211e1bfe215876d995aa501abd8
@@ -1,7 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### 2.7.0 (2015-12-08)
4
+ - New: Now option style can append to inlines styles
5
+
3
6
  ### 2.6.0 (2015-12-07)
4
- - New - Alias mapping so several different names can be used to reference icons
7
+ - New: Alias mapping so several different names can be used to reference icons
5
8
 
6
9
  ### 2.5.0 (2015-11-03)
7
10
  - Improved logging
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
+ # Add custom styles
69
+ <%= svg_icon 'kitten', style: 'color: #c0ffee' %>
70
+
71
+ # Output:
72
+ # <svg class="icon kitten-icon" style="color: #coffee;"><use xlink:href="#kitten-icon"/></svg>
73
+
68
74
  # Add title and desc tags for SVG accessibility.
69
75
  <%= svg_icon 'kitten', title: "Mr. Snuggles", desc: "A graphic of a cat snuggling a ball of yarn" %>
70
76
 
@@ -148,6 +148,13 @@ module Esvg
148
148
  def svg_icon(file, options={})
149
149
  embed = use_icon(file)
150
150
  embed = embed.sub(/class="(.+?)"/, 'class="\1 '+options[:class]+'"') if options[:class]
151
+ if options[:style]
152
+ if embed.match(/style/)
153
+ embed = embed.sub(/style="(.+?)"/, 'style="\1; '+options[:style]+'"')
154
+ else
155
+ embed = embed.sub(/><use/, %Q{ style="#{options[:style]}"><use})
156
+ end
157
+ end
151
158
  embed = embed.sub(/><\/svg/, ">#{title(options)}#{desc(options)}</svg")
152
159
  embed
153
160
  end
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "2.6.0"
2
+ VERSION = "2.7.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: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis