svg_sprite 1.0.1 → 1.0.3

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
  SHA256:
3
- metadata.gz: dad974718ab6a4417495499e8aa788e041663a5f11819611e651a2c05bd378da
4
- data.tar.gz: e77c32dce5a61f03ddc881f9a3e01895ee79fa7447a3ad2dd770cb39be468a6f
3
+ metadata.gz: 102ffaf3f4314cb00bea8e473f8d82a20b598a727c522f36ea0443a9ff9ef089
4
+ data.tar.gz: cd212d62cb0a88314a1f111a6f56de52fbf84a9c5157c706694609fdd7ec8136
5
5
  SHA512:
6
- metadata.gz: 37b27b2ab2af3ec6a728eee52e636e446eae3a38b1672e853bb72d70c631a6f52bccdf10c94a70a85f0bc6bb15a266a8c0818bcc240c2b6a56037d9443684c71
7
- data.tar.gz: 44b8b4bc240067b9e5ee979ecd27f320c83bfbf9a3539e67c2ecee6d3593a6560bed125968118295a6f7cbd7d37762e302af180fe990d0fe7775ae686e65d0b7
6
+ metadata.gz: e8e0a194d46fd6dbe33ab04c0ea9552a2925d2019e4a62fd5a9f69b9dae07c29b9c7f9f5729dd3c7211664bf2a3b034d663bf6fdc34b33a06425c21bd6815229
7
+ data.tar.gz: c0a0f242c808e663e3a20f4a688116bb042b730de598ff8827efa80dea47770f79d631b07a809139b64f5cbe7d7163f9d6fb45eb4ba9bd8b6417e78faeb34632
@@ -24,9 +24,9 @@ jobs:
24
24
  - Gemfile
25
25
 
26
26
  steps:
27
- - uses: actions/checkout@v2.4.0
27
+ - uses: actions/checkout@v3
28
28
 
29
- - uses: actions/cache@v2
29
+ - uses: actions/cache@v3
30
30
  with:
31
31
  path: vendor/bundle
32
32
  key: >
data/CHANGELOG.md CHANGED
@@ -11,6 +11,19 @@ Prefix your message with one of the following:
11
11
  - [Security] in case of vulnerabilities.
12
12
  -->
13
13
 
14
+ ## v1.0.3
15
+
16
+ - [Changed] SVG sprite won't include `display: none` anymore; instead, a class
17
+ `:name--sprite` is added. This eases the CSP setups, as it won't include a
18
+ inline style. Make sure you hide the sprite with something like
19
+ `.icon--sprite { display: none }`.
20
+
21
+ ## v1.0.2
22
+
23
+ - [Changed] Remove `<symbol>`'s `width` and `height` property, otherwise Google
24
+ Chrome and Firefox won't be able to resize the SVG properly. The `viewBox`
25
+ will determine the svg's dimensions.
26
+
14
27
  ## v1.0.1
15
28
 
16
29
  - [Changed] SVG sprite now includes the sprite name as the id. It means you'll
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # svg_sprite
2
2
 
3
3
  [![Tests](https://github.com/fnando/svg_sprite/workflows/ruby-tests/badge.svg)](https://github.com/fnando/svg_sprite)
4
- [![Code Climate](https://codeclimate.com/github/fnando/svg_sprite/badges/gpa.svg)](https://codeclimate.com/github/fnando/svg_sprite)
5
4
  [![Gem](https://img.shields.io/gem/v/svg_sprite.svg)](https://rubygems.org/gems/svg_sprite)
6
5
  [![Gem](https://img.shields.io/gem/dt/svg_sprite.svg)](https://rubygems.org/gems/svg_sprite)
7
6
 
@@ -165,18 +164,18 @@ SvgSprite.call(
165
164
 
166
165
  ## Contributors
167
166
 
168
- - https://github.com/fnando/svg_sprite/contributors
167
+ - <https://github.com/fnando/svg_sprite/contributors>
169
168
 
170
169
  ## Contributing
171
170
 
172
171
  For more details about how to contribute, please read
173
- https://github.com/fnando/svg_sprite/blob/main/CONTRIBUTING.md.
172
+ <https://github.com/fnando/svg_sprite/blob/main/CONTRIBUTING.md>.
174
173
 
175
174
  ## License
176
175
 
177
176
  The gem is available as open source under the terms of the
178
177
  [MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
179
- found at https://github.com/fnando/svg_sprite/blob/main/LICENSE.md.
178
+ found at <https://github.com/fnando/svg_sprite/blob/main/LICENSE.md>.
180
179
 
181
180
  ## Code of Conduct
182
181
 
@@ -12,10 +12,16 @@ class SvgSprite
12
12
  @fill = fill
13
13
  end
14
14
 
15
+ def svg
16
+ @svg ||= xml.css("svg").first
17
+ end
18
+
15
19
  def symbol
16
- @symbol ||= xml.css("svg").first.clone.tap do |node|
20
+ @symbol ||= svg.clone.tap do |node|
17
21
  node.name = "symbol"
18
22
  node.set_attribute :id, id
23
+ node.remove_attribute "width"
24
+ node.remove_attribute "height"
19
25
 
20
26
  process_stroke(node)
21
27
  process_fill(node)
@@ -23,11 +29,11 @@ class SvgSprite
23
29
  end
24
30
 
25
31
  def width
26
- symbol[:width]
32
+ svg[:width]
27
33
  end
28
34
 
29
35
  def height
30
- symbol[:height]
36
+ svg[:height]
31
37
  end
32
38
 
33
39
  def id
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class SvgSprite
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.3"
5
5
  end
data/lib/svg_sprite.rb CHANGED
@@ -134,7 +134,7 @@ class SvgSprite
134
134
  Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
135
135
  xml.svg(
136
136
  xmlns: "http://www.w3.org/2000/svg",
137
- style: "display: none"
137
+ class: "#{name}--sprite"
138
138
  ) do |svg|
139
139
  svg.defs { } # rubocop:disable Lint/EmptyBlock
140
140
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svg_sprite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-05 00:00:00.000000000 Z
11
+ date: 2023-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  - !ruby/object:Gem::Version
228
228
  version: '0'
229
229
  requirements: []
230
- rubygems_version: 3.3.3
230
+ rubygems_version: 3.4.3
231
231
  signing_key:
232
232
  specification_version: 4
233
233
  summary: Create SVG sprites using SVG links.