stylicon 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9af3fe5da6c68d6f86d93e6a173f0094016bd65125c3e4da49a54d485e187ac9
4
- data.tar.gz: 226843d7967a4cf0c7004eda7203bd31181dba496d500d731ab9e3afce2b352f
3
+ metadata.gz: b83f6b94512407132c31182fd748dfc88717750dec0c43b9ee0124a4c07ced0b
4
+ data.tar.gz: 92d6a6411a68168c19604d842ad51ed6f94d4d2ce99d4569470f3eb3940c4100
5
5
  SHA512:
6
- metadata.gz: c1fb2626ab3d2caf0bb144a44a07fe91d7d48aa2d3714e996837369574f327c41870fb3b273b100a9283dd5f6c9ec0e75451132816acd34a74de9ae4cf14ea87
7
- data.tar.gz: a41ee5008598570cf22013734954cdd45d52507b7f2db78cc4b8adff96185bd76436c129cef7fe33a0a708d9b4ab26c22d09a066e8c107adb26fbe5a653a66f5
6
+ metadata.gz: f79e90f11efd27d9895e5b58db06d40bcfd54a97d2a4239be5ad74e562141f22f452183f40b2d9d75b7f461d589094e4d21913aad3cb06b0ba6f884323bbd66d
7
+ data.tar.gz: d04f7187a642776b29d2c8b49136feac297103dbf26e424e98df97425d29b961ba383e80d6a26b46da27512955c6dcb4be4dd62532e1904e00379faae39c1fd0
@@ -19,14 +19,15 @@ module Stylicon
19
19
  width = opts["width"]
20
20
  height = opts["height"]
21
21
  classes = Array(opts["class"] || ".icon-#{name}")
22
+ background = opts["background"]
22
23
 
23
24
  svg = File.read(path)
24
25
  doc = Nokogiri::XML(svg)
25
26
 
26
27
  svg_node = doc.at_css("svg")
27
- svg_node["fill"] = fill if fill
28
- svg_node["width"] = width.to_s if width
29
- svg_node["height"] = height.to_s if height
28
+ svg_node.remove_attribute("fill")
29
+ svg_node.remove_attribute("width")
30
+ svg_node.remove_attribute("height")
30
31
 
31
32
  doc.css("*[fill]").each { |el| el.remove_attribute("fill") }
32
33
 
@@ -34,11 +35,12 @@ module Stylicon
34
35
 
35
36
  css << <<~RULE
36
37
  #{classes.join(", ")} {
37
- background-image: url("data:image/svg+xml;base64,#{encoded}");
38
- background-repeat: no-repeat;
39
- background-size: contain;
40
- width: #{width}px;
41
- height: #{height}px;
38
+ -webkit-mask-image: url("data:image/svg+xml;base64,#{encoded}");
39
+ -webkit-mask-repeat: no-repeat;
40
+ -webkit-mask-size: contain;
41
+ -webkit-mask-position: center;
42
+ display: inline-block;
43
+ #{background ? "background-color: #{background};" : ""}
42
44
  }
43
45
 
44
46
  RULE
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stylicon
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JG
@@ -33,6 +33,7 @@ files:
33
33
  - lib/stylicon/version.rb
34
34
  - sig/stylicon.rbs
35
35
  - stylicon-0.1.0.gem
36
+ - stylicon-0.1.1.gem
36
37
  - stylicon.css
37
38
  homepage: https://github.com/JuanGuiricich/stylicon
38
39
  licenses: