stylicon 0.1.4 → 0.1.5

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: 1d7e9febec03eb4e54707136a4226eb7d2ec98eac58dfc93c6fd8824752d80bc
4
- data.tar.gz: 0c2234cb5ce01b6259123e46a69a8e449dc3ae8c5925258bc4beb55514cb7a8e
3
+ metadata.gz: b7e165f82e296d7dcf81e60bdc3e1fab621503b8495737514f274d02f8727d75
4
+ data.tar.gz: 81c154b6671858731633933609302149b5d8e40aaadc713131fc1c4cf1ec054f
5
5
  SHA512:
6
- metadata.gz: 7c339387702edded829374b5bd80971d20c6fc0c2e449d1954d6aca6ac222f2b6bf09d11f8d0fdd3401335bbfbf58b49fcd553463b6264953b3b0a55f9f32ca8
7
- data.tar.gz: 1da8fa29f93f1944cc518e0509a7a4f5fa734081fd20218ff8b1ce6d514ad09f3c727d60298377913543294f7b12f4a9223ec9bf360408d30b7b82871e765ddb
6
+ metadata.gz: c1e3e1ff72864bc69c2995afaaab7b151da01fd19a962ba3b6a945fdb97c4cc65fd23b6822b9d3d2490462f008f222bdb96454892b431c68c4bb9dba28b92794
7
+ data.tar.gz: 394e189d075a7e81031d3a566982efb0ab2b688c81dc3100fd472c5a05434083112b59d750d37ece56f32e6e3d393e587ba116781720ac53f0f9d90300c0fb9e
@@ -2,11 +2,15 @@ require "nokogiri"
2
2
 
3
3
  module Stylicon
4
4
  class Transformer
5
- def initialize(input_svg:, output_svg:, style: nil, classes: nil)
5
+ def initialize(input_svg:, output_svg:, style: nil, classes: nil, fill: nil, stroke: nil, width: nil, height: nil)
6
6
  @input_svg = input_svg
7
7
  @output_svg = output_svg
8
8
  @style = style
9
9
  @classes = classes
10
+ @fill = fill
11
+ @stroke = stroke
12
+ @width = width
13
+ @height = height
10
14
  end
11
15
 
12
16
  def transform
@@ -16,6 +20,26 @@ module Stylicon
16
20
  svg["style"] = [svg["style"], @style].compact.join("; ") if @style
17
21
  svg["class"] = [svg["class"], @classes].compact.join(" ") if @classes
18
22
 
23
+ if @fill
24
+ doc.css("*[fill]").each do |element|
25
+ element["fill"] = @fill unless element["fill"] == "none"
26
+ end
27
+ end
28
+
29
+ if @width
30
+ svg["width"] = @width
31
+ end
32
+
33
+ if @height
34
+ svg["height"] = @height
35
+ end
36
+
37
+ if @stroke
38
+ doc.css("*[stroke]").each do |element|
39
+ element["stroke"] = @stroke unless element["stroke"] == "none"
40
+ end
41
+ end
42
+
19
43
  File.write(@output_svg, doc.to_xml)
20
44
  puts "🎨 Transformed SVG written to #{@output_svg}"
21
45
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stylicon
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
5
5
  end
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.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - JG
@@ -33,10 +33,6 @@ files:
33
33
  - lib/stylicon/transformer.rb
34
34
  - lib/stylicon/version.rb
35
35
  - sig/stylicon.rbs
36
- - stylicon-0.1.0.gem
37
- - stylicon-0.1.1.gem
38
- - stylicon-0.1.2.gem
39
- - stylicon-0.1.3.gem
40
36
  - stylicon.css
41
37
  homepage: https://github.com/JuanGuiricich/stylicon
42
38
  licenses:
@@ -60,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
56
  - !ruby/object:Gem::Version
61
57
  version: '0'
62
58
  requirements: []
63
- rubygems_version: 3.6.7
59
+ rubygems_version: 3.7.1
64
60
  specification_version: 4
65
61
  summary: Generate performant CSS classes from SVGs using YAML configuration.
66
62
  test_files: []
data/stylicon-0.1.0.gem DELETED
Binary file
data/stylicon-0.1.1.gem DELETED
Binary file
data/stylicon-0.1.2.gem DELETED
Binary file
data/stylicon-0.1.3.gem DELETED
Binary file