stylicon 0.1.3 → 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: cbcc1860c16abaab6fd74a213acd88046cee962bfa8b3c717d75788072ce16c9
4
- data.tar.gz: 47940bec8c9086f935eae057a3534222e921072d6f487fa566dcad77c6a7b37f
3
+ metadata.gz: 1d7e9febec03eb4e54707136a4226eb7d2ec98eac58dfc93c6fd8824752d80bc
4
+ data.tar.gz: 0c2234cb5ce01b6259123e46a69a8e449dc3ae8c5925258bc4beb55514cb7a8e
5
5
  SHA512:
6
- metadata.gz: bf1d5a3aa8158b1f06f2c2677b1bc6f0ab7894538a8cdf82d19754e3010b66a84b59908b9cb873f43a7cae8a70e4f2724dd9473fcc75f5527b7adc8bfda85fee
7
- data.tar.gz: b363134a914332802a5b8ec584aaf892a9d51aa3ba8fa1f283d72fba3b98fe179ae284b6ab329bee8054c2ffecc38e6523c66b9b4c0deda288e8cf809456a2de
6
+ metadata.gz: 7c339387702edded829374b5bd80971d20c6fc0c2e449d1954d6aca6ac222f2b6bf09d11f8d0fdd3401335bbfbf58b49fcd553463b6264953b3b0a55f9f32ca8
7
+ data.tar.gz: 1da8fa29f93f1944cc518e0509a7a4f5fa734081fd20218ff8b1ce6d514ad09f3c727d60298377913543294f7b12f4a9223ec9bf360408d30b7b82871e765ddb
@@ -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.3"
4
+ VERSION = "0.1.4"
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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - JG
@@ -30,11 +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
37
38
  - stylicon-0.1.2.gem
39
+ - stylicon-0.1.3.gem
38
40
  - stylicon.css
39
41
  homepage: https://github.com/JuanGuiricich/stylicon
40
42
  licenses: