stylicon 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9af3fe5da6c68d6f86d93e6a173f0094016bd65125c3e4da49a54d485e187ac9
4
- data.tar.gz: 226843d7967a4cf0c7004eda7203bd31181dba496d500d731ab9e3afce2b352f
3
+ metadata.gz: cbcc1860c16abaab6fd74a213acd88046cee962bfa8b3c717d75788072ce16c9
4
+ data.tar.gz: 47940bec8c9086f935eae057a3534222e921072d6f487fa566dcad77c6a7b37f
5
5
  SHA512:
6
- metadata.gz: c1fb2626ab3d2caf0bb144a44a07fe91d7d48aa2d3714e996837369574f327c41870fb3b273b100a9283dd5f6c9ec0e75451132816acd34a74de9ae4cf14ea87
7
- data.tar.gz: a41ee5008598570cf22013734954cdd45d52507b7f2db78cc4b8adff96185bd76436c129cef7fe33a0a708d9b4ab26c22d09a066e8c107adb26fbe5a653a66f5
6
+ metadata.gz: bf1d5a3aa8158b1f06f2c2677b1bc6f0ab7894538a8cdf82d19754e3010b66a84b59908b9cb873f43a7cae8a70e4f2724dd9473fcc75f5527b7adc8bfda85fee
7
+ data.tar.gz: b363134a914332802a5b8ec584aaf892a9d51aa3ba8fa1f283d72fba3b98fe179ae284b6ab329bee8054c2ffecc38e6523c66b9b4c0deda288e8cf809456a2de
data/bin/stylicon CHANGED
@@ -3,6 +3,23 @@
3
3
 
4
4
  require_relative "../lib/stylicon"
5
5
  require_relative "../lib/stylicon/generator"
6
+ require_relative "../lib/stylicon/transformer"
7
+
8
+ if ARGV[0] == "--transform-svg"
9
+ input = ARGV[1]
10
+ out = ARGV[ARGV.index("--out") + 1]
11
+ style = ARGV.include?("--style") ? ARGV[ARGV.index("--style") + 1] : nil
12
+ classes = ARGV.include?("--classes") ? ARGV[ARGV.index("--classes") + 1] : nil
13
+
14
+ Stylicon::Transformer.new(
15
+ input_svg: input,
16
+ output_svg: out,
17
+ style: style,
18
+ classes: classes
19
+ ).transform
20
+
21
+ exit 0
22
+ end
6
23
 
7
24
  config = ARGV[0] || "icons.yml"
8
25
  output = ARGV[1] || "stylicon.css"
@@ -15,18 +15,16 @@ module Stylicon
15
15
 
16
16
  config.each do |name, opts|
17
17
  path = opts["path"]
18
- fill = opts["fill"]
19
- width = opts["width"]
20
- height = opts["height"]
21
18
  classes = Array(opts["class"] || ".icon-#{name}")
19
+ background = opts["background"]
22
20
 
23
21
  svg = File.read(path)
24
22
  doc = Nokogiri::XML(svg)
25
23
 
26
24
  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
25
+ svg_node.remove_attribute("fill")
26
+ svg_node.remove_attribute("width")
27
+ svg_node.remove_attribute("height")
30
28
 
31
29
  doc.css("*[fill]").each { |el| el.remove_attribute("fill") }
32
30
 
@@ -34,11 +32,12 @@ module Stylicon
34
32
 
35
33
  css << <<~RULE
36
34
  #{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;
35
+ -webkit-mask-image: url("data:image/svg+xml;base64,#{encoded}");
36
+ -webkit-mask-repeat: no-repeat;
37
+ -webkit-mask-size: contain;
38
+ -webkit-mask-position: center;
39
+ display: inline-block;
40
+ #{background ? "background-color: #{background};" : ""}
42
41
  }
43
42
 
44
43
  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.3"
5
5
  end
Binary file
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JG
@@ -33,6 +33,8 @@ 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
37
+ - stylicon-0.1.2.gem
36
38
  - stylicon.css
37
39
  homepage: https://github.com/JuanGuiricich/stylicon
38
40
  licenses: