sprockets-svg 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/lib/sprockets/svg.rb +4 -4
- data/lib/sprockets/svg/version.rb +1 -1
- data/spec/rails_spec.rb +4 -4
- data/sprockets-svg.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fee6af75119887732b4e97a8afaf1ec08ef1f3c1
|
4
|
+
data.tar.gz: 7c1a691014cff3c1b015bf61c4a5aabcbf29db6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a32892bca945d59c47911c913b93661115dcc065797b05f00f861a37acd105937058558e1da1a7b123fe9535642e0fb2cb4865b607040c6066d74eb71cde295
|
7
|
+
data.tar.gz: 5c68e3ad341762caf3fb705439a46c35b165c4c24dc949731d8650c5e764f751ca6b8e650198af074b46fdd00d7e9810d308433e1d61d7a0d4cee6eef47da9ad
|
data/.travis.yml
CHANGED
data/lib/sprockets/svg.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'sprockets/svg/version'
|
2
2
|
require 'chunky_png'
|
3
|
-
require '
|
3
|
+
require 'mini_magick'
|
4
4
|
|
5
5
|
module Sprockets
|
6
6
|
module Svg
|
@@ -11,9 +11,9 @@ module Sprockets
|
|
11
11
|
# TODO: integrate svgo instead: https://github.com/svg/svgo
|
12
12
|
# See https://github.com/lautis/uglifier on how to integrate a npm package as a gem.
|
13
13
|
def self.convert(svg_blob)
|
14
|
-
|
15
|
-
image =
|
16
|
-
image.format
|
14
|
+
stream = StringIO.new(svg_blob)
|
15
|
+
image = MiniMagick::Image.create('.svg', false) { |file| IO.copy_stream(stream, file) }
|
16
|
+
image.format('png')
|
17
17
|
strip_png_metadata(image.to_blob)
|
18
18
|
end
|
19
19
|
|
data/spec/rails_spec.rb
CHANGED
@@ -69,15 +69,15 @@ describe 'Sprockets::Svg' do
|
|
69
69
|
describe AssetsController, type: :controller do
|
70
70
|
|
71
71
|
it 'rack' do
|
72
|
-
get :test, file: 'facebook.png'
|
73
|
-
expect(response).to
|
72
|
+
get :test, params: { file: 'facebook.png' }
|
73
|
+
expect(response).to be_successful
|
74
74
|
expect(response.body.force_encoding('utf-8')).to be_starts_with("\x89PNG\r\n".force_encoding('utf-8'))
|
75
75
|
expect(response.headers['Content-Type']).to match %r{image/png}
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'compile scss' do
|
79
|
-
get :test, file: 'application.css'
|
80
|
-
expect(response).to
|
79
|
+
get :test, params: { file: 'application.css' }
|
80
|
+
expect(response).to be_successful
|
81
81
|
expect(response.body).to match %r{url\(/assets/facebook-\w+\.svg\)}
|
82
82
|
expect(response.body).to match %r{url\(/assets/facebook-\w+\.png\)}
|
83
83
|
end
|
data/sprockets-svg.gemspec
CHANGED
@@ -21,6 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
22
|
spec.add_dependency 'sprockets', '>= 3'
|
23
23
|
spec.add_dependency 'nokogiri'
|
24
|
-
spec.add_dependency '
|
24
|
+
spec.add_dependency 'mini_magick'
|
25
25
|
spec.add_dependency 'chunky_png'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Boussier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: mini_magick
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|