esvg 4.3.5 → 4.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/esvg +14 -1
- data/lib/esvg.rb +9 -2
- data/lib/esvg/svgs.rb +2 -0
- data/lib/esvg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bdc810b198a87a377e9460a3216b5e627606d11
|
4
|
+
data.tar.gz: 26177994d576344b015093fe90bcc269a7458cbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd18ccb361f8e4916d9a349f1b443cfbeaf3ce60ecf2eb6b36a762e291f4ff8d05c1abe12154baabc106e12552652cb38338f5625ed46848c2c7cc54f8f13092
|
7
|
+
data.tar.gz: fe017ac769eddedf743dfe7a459fbcf1d42e7c58fa6c49b43947297fd8602f4cd642dc2ba05e392a83a0be73f0f00df1afc0a119b12effd28b7f4a4d2062cc7d
|
data/exe/esvg
CHANGED
@@ -43,10 +43,18 @@ OptionParser.new do |opts|
|
|
43
43
|
options[:gzip] = true
|
44
44
|
end
|
45
45
|
|
46
|
+
opts.on("--seed", "Seed cache file with optimized svgs") do
|
47
|
+
options[:seed] = true
|
48
|
+
end
|
49
|
+
|
46
50
|
opts.on("-v", "--version", "Print version") do
|
47
51
|
options[:version] = true
|
48
52
|
end
|
49
53
|
|
54
|
+
opts.on("--test", "test func") do
|
55
|
+
options[:test] = true
|
56
|
+
end
|
57
|
+
|
50
58
|
end.parse!
|
51
59
|
|
52
60
|
if options[:version]
|
@@ -58,5 +66,10 @@ else
|
|
58
66
|
end
|
59
67
|
|
60
68
|
options[:print] = true
|
61
|
-
|
69
|
+
|
70
|
+
if options[:seed]
|
71
|
+
Esvg.seed_cache(options)
|
72
|
+
else
|
73
|
+
esvg = Esvg.new(options).build
|
74
|
+
end
|
62
75
|
end
|
data/lib/esvg.rb
CHANGED
@@ -43,6 +43,13 @@ module Esvg
|
|
43
43
|
find_svgs(names).map{|s| s.build_paths(names) }.flatten
|
44
44
|
end
|
45
45
|
|
46
|
+
def seed_cache(options)
|
47
|
+
svgs = Svgs.new(options)
|
48
|
+
puts "Optimizing SVGs" if options[:print]
|
49
|
+
svgs.symbols.map(&:optimize)
|
50
|
+
svgs.write_cache
|
51
|
+
end
|
52
|
+
|
46
53
|
def find_svgs(names=nil)
|
47
54
|
@svgs.select {|s| s.buildable_svgs(names) }
|
48
55
|
end
|
@@ -54,7 +61,7 @@ module Esvg
|
|
54
61
|
end
|
55
62
|
|
56
63
|
def rails?
|
57
|
-
defined?(Rails)
|
64
|
+
defined?(Rails) || File.exist?("./bin/rails")
|
58
65
|
end
|
59
66
|
|
60
67
|
def html_safe(input)
|
@@ -63,7 +70,7 @@ module Esvg
|
|
63
70
|
end
|
64
71
|
|
65
72
|
def precompile_assets
|
66
|
-
if
|
73
|
+
if defined?(Rails) && Rails.env.production? && defined?(Rake)
|
67
74
|
::Rake::Task['assets:precompile'].enhance do
|
68
75
|
Svgs.new(gzip: true, print: true).build
|
69
76
|
end
|
data/lib/esvg/svgs.rb
CHANGED
data/lib/esvg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: esvg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|