svg_sprite 1.0.1 → 1.0.3
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/.github/workflows/ruby-tests.yml +2 -2
- data/CHANGELOG.md +13 -0
- data/README.md +3 -4
- data/lib/svg_sprite/svg.rb +9 -3
- data/lib/svg_sprite/version.rb +1 -1
- data/lib/svg_sprite.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102ffaf3f4314cb00bea8e473f8d82a20b598a727c522f36ea0443a9ff9ef089
|
4
|
+
data.tar.gz: cd212d62cb0a88314a1f111a6f56de52fbf84a9c5157c706694609fdd7ec8136
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8e0a194d46fd6dbe33ab04c0ea9552a2925d2019e4a62fd5a9f69b9dae07c29b9c7f9f5729dd3c7211664bf2a3b034d663bf6fdc34b33a06425c21bd6815229
|
7
|
+
data.tar.gz: c0a0f242c808e663e3a20f4a688116bb042b730de598ff8827efa80dea47770f79d631b07a809139b64f5cbe7d7163f9d6fb45eb4ba9bd8b6417e78faeb34632
|
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
|
[](https://github.com/fnando/svg_sprite)
|
4
|
-
[](https://codeclimate.com/github/fnando/svg_sprite)
|
5
4
|
[](https://rubygems.org/gems/svg_sprite)
|
6
5
|
[](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
|
|
data/lib/svg_sprite/svg.rb
CHANGED
@@ -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 ||=
|
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
|
-
|
32
|
+
svg[:width]
|
27
33
|
end
|
28
34
|
|
29
35
|
def height
|
30
|
-
|
36
|
+
svg[:height]
|
31
37
|
end
|
32
38
|
|
33
39
|
def id
|
data/lib/svg_sprite/version.rb
CHANGED
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
|
-
|
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.
|
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:
|
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.
|
230
|
+
rubygems_version: 3.4.3
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: Create SVG sprites using SVG links.
|