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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4203297d1baa968efa916d3efacaa3b62faea259
4
- data.tar.gz: 6f94000f4b5c4087b08396b2fec368b0fbf13746
3
+ metadata.gz: c6e52e2c93bb2014d058e1e67b21993ae847b127
4
+ data.tar.gz: 134f0a997e953e2216ab91a28ac2b8d78c6d49d6
5
5
  SHA512:
6
- metadata.gz: c80284abcae923930e8beb6cef752ce9114ebbced458f0853a01801ec3bf421119d7f9ab2a5779f146c70627c96463969c4aef9787a7fe3f4453f95f3aa3322c
7
- data.tar.gz: e2f092bca43e6e24831733db7ed40b29e378bd29a49e04b10fd6a67ed1a1d6c4f0fef17bf3fa48b1fbdb75abe97b3c6ddc07ac7678b010132e5d8815f3f8b845
6
+ metadata.gz: 6fa72d0b91eca23f0c230643ae9c7f61a97d41990a12e43bf654ee0356dc4224353acf0a3af4a1036f90fc32443cabfe3d232c6672b0026aff46734f1c535445
7
+ data.tar.gz: 0e273e7eaa3f52dbacd920921d1b5f3c2e36031e8043293b1b6d916314981f784eb229af44ca186916676642b5715f8c708060e614d0536eb7f559bec4908b8c
@@ -1,6 +1,9 @@
1
1
  # Changelog
2
2
 
3
- ### 2.2.5 (2015-10-05)
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)
@@ -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
- !(`npm ls -g svgo`.match(/empty/) && `npm ls svgo`.match(/emtpy/))
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
- `svgo #{file} -o -`
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
@@ -1,3 +1,3 @@
1
1
  module Esvg
2
- VERSION = "2.3.0"
2
+ VERSION = "2.3.1"
3
3
  end
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.0
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-06 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler