esvg 2.3.0 → 2.3.1
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/CHANGELOG.md +4 -1
- data/lib/esvg/svg.rb +13 -3
- 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: c6e52e2c93bb2014d058e1e67b21993ae847b127
|
4
|
+
data.tar.gz: 134f0a997e953e2216ab91a28ac2b8d78c6d49d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa72d0b91eca23f0c230643ae9c7f61a97d41990a12e43bf654ee0356dc4224353acf0a3af4a1036f90fc32443cabfe3d232c6672b0026aff46734f1c535445
|
7
|
+
data.tar.gz: 0e273e7eaa3f52dbacd920921d1b5f3c2e36031e8043293b1b6d916314981f784eb229af44ca186916676642b5715f8c708060e614d0536eb7f559bec4908b8c
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
### 2.
|
3
|
+
### 2.3.1 (2015-10-15)
|
4
|
+
- Minor: Added `svgo_path` config option to specifiy a direct path to the svgo binary.
|
5
|
+
|
6
|
+
### 2.3.0 (2015-10-05)
|
4
7
|
- New: Now using viewport size to write svg dimensions. Some editors export SVG as 100% width and height, which is annoying if you want a set size.
|
5
8
|
|
6
9
|
### 2.2.5 (2015-10-02)
|
data/lib/esvg/svg.rb
CHANGED
@@ -9,6 +9,7 @@ module Esvg
|
|
9
9
|
base_class: 'svg-icon',
|
10
10
|
namespace: 'icon',
|
11
11
|
optimize: false,
|
12
|
+
svgo_path: false,
|
12
13
|
namespace_before: true,
|
13
14
|
font_size: '1em',
|
14
15
|
output_path: Dir.pwd,
|
@@ -23,6 +24,7 @@ module Esvg
|
|
23
24
|
def initialize(options={})
|
24
25
|
config(options)
|
25
26
|
read_icons
|
27
|
+
@svgo = nil
|
26
28
|
@cache = {}
|
27
29
|
end
|
28
30
|
|
@@ -44,7 +46,15 @@ module Esvg
|
|
44
46
|
|
45
47
|
def svgo?
|
46
48
|
@svgo ||= begin
|
47
|
-
|
49
|
+
local_path = config[:svgo_path] || "#{Dir.pwd}/node_modules/svgo/bin/svgo"
|
50
|
+
|
51
|
+
if File.exist?(local_path)
|
52
|
+
local_path
|
53
|
+
elsif `npm ls -g svgo`.match(/empty/).nil?
|
54
|
+
"svgo"
|
55
|
+
else
|
56
|
+
false
|
57
|
+
end
|
48
58
|
end
|
49
59
|
end
|
50
60
|
|
@@ -76,8 +86,8 @@ module Esvg
|
|
76
86
|
|
77
87
|
def read(file)
|
78
88
|
if config[:optimize] && svgo?
|
79
|
-
# Compress files outputting to $STDOUT
|
80
|
-
|
89
|
+
# Compress files outputting to $STDOUT which returns as a string
|
90
|
+
`#{@svgo} #{file} -o -`
|
81
91
|
else
|
82
92
|
File.read(file)
|
83
93
|
end
|
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: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|