stylicon 0.1.2 → 0.1.4

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: b83f6b94512407132c31182fd748dfc88717750dec0c43b9ee0124a4c07ced0b
4
- data.tar.gz: 92d6a6411a68168c19604d842ad51ed6f94d4d2ce99d4569470f3eb3940c4100
3
+ metadata.gz: 1d7e9febec03eb4e54707136a4226eb7d2ec98eac58dfc93c6fd8824752d80bc
4
+ data.tar.gz: 0c2234cb5ce01b6259123e46a69a8e449dc3ae8c5925258bc4beb55514cb7a8e
5
5
  SHA512:
6
- metadata.gz: f79e90f11efd27d9895e5b58db06d40bcfd54a97d2a4239be5ad74e562141f22f452183f40b2d9d75b7f461d589094e4d21913aad3cb06b0ba6f884323bbd66d
7
- data.tar.gz: d04f7187a642776b29d2c8b49136feac297103dbf26e424e98df97425d29b961ba383e80d6a26b46da27512955c6dcb4be4dd62532e1904e00379faae39c1fd0
6
+ metadata.gz: 7c339387702edded829374b5bd80971d20c6fc0c2e449d1954d6aca6ac222f2b6bf09d11f8d0fdd3401335bbfbf58b49fcd553463b6264953b3b0a55f9f32ca8
7
+ data.tar.gz: 1da8fa29f93f1944cc518e0509a7a4f5fa734081fd20218ff8b1ce6d514ad09f3c727d60298377913543294f7b12f4a9223ec9bf360408d30b7b82871e765ddb
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,9 +15,6 @@ 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}")
22
19
  background = opts["background"]
23
20
 
@@ -0,0 +1,23 @@
1
+ require "nokogiri"
2
+
3
+ module Stylicon
4
+ class Transformer
5
+ def initialize(input_svg:, output_svg:, style: nil, classes: nil)
6
+ @input_svg = input_svg
7
+ @output_svg = output_svg
8
+ @style = style
9
+ @classes = classes
10
+ end
11
+
12
+ def transform
13
+ doc = Nokogiri::XML(File.read(@input_svg))
14
+ svg = doc.at_css("svg")
15
+
16
+ svg["style"] = [svg["style"], @style].compact.join("; ") if @style
17
+ svg["class"] = [svg["class"], @classes].compact.join(" ") if @classes
18
+
19
+ File.write(@output_svg, doc.to_xml)
20
+ puts "🎨 Transformed SVG written to #{@output_svg}"
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stylicon
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
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.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JG
@@ -30,10 +30,13 @@ files:
30
30
  - icons.yml
31
31
  - lib/stylicon.rb
32
32
  - lib/stylicon/generator.rb
33
+ - lib/stylicon/transformer.rb
33
34
  - lib/stylicon/version.rb
34
35
  - sig/stylicon.rbs
35
36
  - stylicon-0.1.0.gem
36
37
  - stylicon-0.1.1.gem
38
+ - stylicon-0.1.2.gem
39
+ - stylicon-0.1.3.gem
37
40
  - stylicon.css
38
41
  homepage: https://github.com/JuanGuiricich/stylicon
39
42
  licenses: