stylicon 0.1.3 → 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 +4 -4
- data/lib/stylicon/transformer.rb +47 -0
- data/lib/stylicon/version.rb +1 -1
- metadata +3 -5
- data/stylicon-0.1.0.gem +0 -0
- data/stylicon-0.1.1.gem +0 -0
- data/stylicon-0.1.2.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7e165f82e296d7dcf81e60bdc3e1fab621503b8495737514f274d02f8727d75
|
|
4
|
+
data.tar.gz: 81c154b6671858731633933609302149b5d8e40aaadc713131fc1c4cf1ec054f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1e3e1ff72864bc69c2995afaaab7b151da01fd19a962ba3b6a945fdb97c4cc65fd23b6822b9d3d2490462f008f222bdb96454892b431c68c4bb9dba28b92794
|
|
7
|
+
data.tar.gz: 394e189d075a7e81031d3a566982efb0ab2b688c81dc3100fd472c5a05434083112b59d750d37ece56f32e6e3d393e587ba116781720ac53f0f9d90300c0fb9e
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require "nokogiri"
|
|
2
|
+
|
|
3
|
+
module Stylicon
|
|
4
|
+
class Transformer
|
|
5
|
+
def initialize(input_svg:, output_svg:, style: nil, classes: nil, fill: nil, stroke: nil, width: nil, height: nil)
|
|
6
|
+
@input_svg = input_svg
|
|
7
|
+
@output_svg = output_svg
|
|
8
|
+
@style = style
|
|
9
|
+
@classes = classes
|
|
10
|
+
@fill = fill
|
|
11
|
+
@stroke = stroke
|
|
12
|
+
@width = width
|
|
13
|
+
@height = height
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def transform
|
|
17
|
+
doc = Nokogiri::XML(File.read(@input_svg))
|
|
18
|
+
svg = doc.at_css("svg")
|
|
19
|
+
|
|
20
|
+
svg["style"] = [svg["style"], @style].compact.join("; ") if @style
|
|
21
|
+
svg["class"] = [svg["class"], @classes].compact.join(" ") if @classes
|
|
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
|
+
|
|
43
|
+
File.write(@output_svg, doc.to_xml)
|
|
44
|
+
puts "🎨 Transformed SVG written to #{@output_svg}"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
data/lib/stylicon/version.rb
CHANGED
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
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- JG
|
|
@@ -30,11 +30,9 @@ 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
|
-
- stylicon-0.1.0.gem
|
|
36
|
-
- stylicon-0.1.1.gem
|
|
37
|
-
- stylicon-0.1.2.gem
|
|
38
36
|
- stylicon.css
|
|
39
37
|
homepage: https://github.com/JuanGuiricich/stylicon
|
|
40
38
|
licenses:
|
|
@@ -58,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
58
56
|
- !ruby/object:Gem::Version
|
|
59
57
|
version: '0'
|
|
60
58
|
requirements: []
|
|
61
|
-
rubygems_version: 3.
|
|
59
|
+
rubygems_version: 3.7.1
|
|
62
60
|
specification_version: 4
|
|
63
61
|
summary: Generate performant CSS classes from SVGs using YAML configuration.
|
|
64
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
|