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 +4 -4
- data/bin/stylicon +17 -0
- data/lib/stylicon/generator.rb +0 -3
- data/lib/stylicon/transformer.rb +23 -0
- data/lib/stylicon/version.rb +1 -1
- data/stylicon-0.1.2.gem +0 -0
- data/stylicon-0.1.3.gem +0 -0
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d7e9febec03eb4e54707136a4226eb7d2ec98eac58dfc93c6fd8824752d80bc
|
|
4
|
+
data.tar.gz: 0c2234cb5ce01b6259123e46a69a8e449dc3ae8c5925258bc4beb55514cb7a8e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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"
|
data/lib/stylicon/generator.rb
CHANGED
|
@@ -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
|
data/lib/stylicon/version.rb
CHANGED
data/stylicon-0.1.2.gem
ADDED
|
Binary file
|
data/stylicon-0.1.3.gem
ADDED
|
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.
|
|
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:
|