stylicon 0.1.0 → 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: 111a0f57b95cce09d7d77703e350c992ea757358660985828268957193094be9
4
- data.tar.gz: 4897ae7917939194a36e91d3db8274ba48aaa279e5692db713f79a1fa0ee7d94
3
+ metadata.gz: b83f6b94512407132c31182fd748dfc88717750dec0c43b9ee0124a4c07ced0b
4
+ data.tar.gz: 92d6a6411a68168c19604d842ad51ed6f94d4d2ce99d4569470f3eb3940c4100
5
5
  SHA512:
6
- metadata.gz: d766fd8e94ab516f2ff730b4a53b58f8ceed417f2826e3b0f566ec9727c6db056790a294b5a95bdbb9414a359a4ff2f45b6f37f02cff49a40f98a318264976e0
7
- data.tar.gz: 768328238b0699608a636c74305932def9cec7c88715e01da1b64813ca96fd6b7fdef6e951293987e0deb3709bf3610be157877006a58a54468871c1710d57b3
6
+ metadata.gz: f79e90f11efd27d9895e5b58db06d40bcfd54a97d2a4239be5ad74e562141f22f452183f40b2d9d75b7f461d589094e4d21913aad3cb06b0ba6f884323bbd66d
7
+ data.tar.gz: d04f7187a642776b29d2c8b49136feac297103dbf26e424e98df97425d29b961ba383e80d6a26b46da27512955c6dcb4be4dd62532e1904e00379faae39c1fd0
data/bin/stylicon ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../lib/stylicon"
5
+ require_relative "../lib/stylicon/generator"
6
+
7
+ config = ARGV[0] || "icons.yml"
8
+ output = ARGV[1] || "stylicon.css"
9
+
10
+ Stylicon::Generator.new(config, output).generate
@@ -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.0"
4
+ VERSION = "0.1.2"
5
5
  end
Binary file
Binary file
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stylicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - JG
8
- bindir: exe
8
+ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies: []
@@ -14,7 +14,8 @@ description: Stylicon is a tool that takes SVG files and a YAML config to genera
14
14
  cacheable icons without bloating HTML or requiring runtime transformations.
15
15
  email:
16
16
  - jguiricich@gmail.com
17
- executables: []
17
+ executables:
18
+ - stylicon
18
19
  extensions: []
19
20
  extra_rdoc_files: []
20
21
  files:
@@ -25,11 +26,14 @@ files:
25
26
  - LICENSE.txt
26
27
  - README.md
27
28
  - Rakefile
29
+ - bin/stylicon
28
30
  - icons.yml
29
31
  - lib/stylicon.rb
30
32
  - lib/stylicon/generator.rb
31
33
  - lib/stylicon/version.rb
32
34
  - sig/stylicon.rbs
35
+ - stylicon-0.1.0.gem
36
+ - stylicon-0.1.1.gem
33
37
  - stylicon.css
34
38
  homepage: https://github.com/JuanGuiricich/stylicon
35
39
  licenses: