jekyll-favicon 1.0.0.pre.2 → 1.0.0.pre.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19375fbd665cb27681d89f590ee75312136a775d623beec4303e42e974f60636
4
- data.tar.gz: d72579b9e971436a3774bdcbf6d20bb1457f50f4e6e682648c85d6434efb3326
3
+ metadata.gz: 2143f5ca47523996edd21924f528455195a44924ce70ff0769bff1a1945c5e1d
4
+ data.tar.gz: b51d9acfbad24d42d244a0e2d0cf992eb2f1c3e22742228887a1da08893d1444
5
5
  SHA512:
6
- metadata.gz: efaf8c6a2e8e2a09ef3e52c7e3f128c5fa6cb3326dcc7a439b6aab4514e6e88d5581f218112e69dbe124a0d0434f49e12d9c92d25f892e4760193cbf5a77e30d
7
- data.tar.gz: c21ad3577929122b8b83bd9befc63ed9abe58a6c48c949d6203acbe656fecb3303c15502982146bcb341d5a4bad4d14fc673ac1603d0ed723aaa21c792ccd77c
6
+ metadata.gz: eeb8f081b15aba2072554ced2a44838b59405aa6e4c1cd56e4cb605bf98eda5a27cd54c78d2ebeaebdb4f8bd03b18da10558f76a2a9c6c37b88a31faf309a820
7
+ data.tar.gz: 0203d4422b676347b4d398735201dc38b238113176e8d8f80af8e86acee013d13bea905070d79e6154ece2dec095583b33b9e8fc8d26f3dad544ad589ffe9bc9
@@ -11,7 +11,9 @@ RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/l
11
11
 
12
12
  # [Optional] Uncomment this section to install additional OS packages.
13
13
  RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
14
- && apt-get -y install --no-install-recommends imagemagick librsvg2-bin
14
+ && apt-get -y install librsvg2-bin
15
+ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
16
+ && apt-get -y install imagemagick
15
17
 
16
18
  # [Optional] Uncomment this line to install additional gems.
17
19
  RUN gem install reek standard webrick
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.0.pre.3] - 2021-06-12
10
+ ### Fixed
11
+ - fix SVG to PNG quality
12
+
9
13
  ## [1.0.0.pre.2] - 2021-06-11
10
14
  ### Fixed
11
15
  - mime time error when starting new project
data/README.md CHANGED
@@ -27,6 +27,8 @@ If you have a [problem converting SVG files](https://github.com/afaundez/jekyll-
27
27
  sudo apt install librsvg2-bin
28
28
  ```
29
29
 
30
+ You may need to install ImageMagick after installing the RSVG renderer.
31
+
30
32
  Check the devcontainer's [Dockerfile](.devcontainer/Dockerfile) for more practical details.
31
33
 
32
34
  ## Installation
@@ -34,7 +36,7 @@ Check the devcontainer's [Dockerfile](.devcontainer/Dockerfile) for more practic
34
36
  Add this line to your application's Gemfile:
35
37
 
36
38
  ```ruby
37
- gem 'jekyll-favicon', '~> 1.0.0.pre.2', group: :jekyll_plugins
39
+ gem 'jekyll-favicon', '~> 1.0.0.pre.3', group: :jekyll_plugins
38
40
  ```
39
41
 
40
42
  ## Usage
@@ -116,12 +118,11 @@ The convert configuration is specific for each type of convertion: SVG to ICO/PN
116
118
  |----------------|---------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
117
119
  | alpha | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick alpha docs](https://imagemagick.org/script/command-line-options.php#alpha) |
118
120
  | background | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick background docs](https://imagemagick.org/script/command-line-options.php#background) |
119
- | define | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick define docs](https://imagemagick.org/script/command-line-options.php#define) |
120
- | density | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick density docs](https://imagemagick.org/script/command-line-options.php#density) |
121
+ | define | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick define docs](https://imagemagick.org/script/command-line-options.php#define) | |
121
122
  | extent | string/symbol | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick extent docs](https://imagemagick.org/script/command-line-options.php#extent) |
122
123
  | gravity | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick gravity docs](https://imagemagick.org/script/command-line-options.php#gravity) |
123
124
  | resize | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick resize docs](https://imagemagick.org/script/command-line-options.php#resize) |
124
- | scale | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick scale docs](https://imagemagick.org/script/command-line-options.php#scale) |
125
+ | size | string | see [convert config](config/jekyll/favicon/static_file/convertible.yml) | see [imagemagick size docs](https://imagemagick.org/script/command-line-options.php#size) |
125
126
 
126
127
  Symbol values:
127
128
 
@@ -8,7 +8,7 @@ assets:
8
8
  - name: favicon.ico
9
9
  convert:
10
10
  define: 'icon:auto-resize=36,24,16'
11
- scale: 36x36
11
+ resize: 36x36
12
12
  tag:
13
13
  - link:
14
14
  href: :href
@@ -17,7 +17,7 @@ assets:
17
17
  sizes: :sizes
18
18
  - name: favicon.png
19
19
  convert:
20
- scale: 196x196
20
+ resize: 196x196
21
21
  tag:
22
22
  - link:
23
23
  href: :href
@@ -26,7 +26,7 @@ assets:
26
26
  sizes: :sizes
27
27
  - name: apple-touch-icon.png
28
28
  convert:
29
- scale: 180x180
29
+ resize: 180x180
30
30
  - name: safari-pinned-tab.svg
31
31
  tag:
32
32
  - link:
@@ -35,21 +35,21 @@ assets:
35
35
  rel: mask-icon
36
36
  - name: android-chrome-192x192.png
37
37
  convert:
38
- scale: 192x192
38
+ resize: 192x192
39
39
  refer:
40
40
  - webmanifest:
41
41
  icons:
42
42
  - src: :href
43
43
  - name: android-chrome-512x512.png
44
44
  convert:
45
- scale: 512x512
45
+ resize: 512x512
46
46
  refer:
47
47
  - webmanifest:
48
48
  icons:
49
49
  - src: :href
50
50
  - name: mstile-icon-128x128.png
51
51
  convert:
52
- scale: 128x128
52
+ resize: 128x128
53
53
  refer:
54
54
  - browserconfig:
55
55
  msapplication:
@@ -68,7 +68,7 @@ assets:
68
68
 
69
69
  - name: mstile-icon-270x270.png
70
70
  convert:
71
- scale: 270x270
71
+ resize: 270x270
72
72
  refer:
73
73
  - browserconfig:
74
74
  msapplication:
@@ -79,7 +79,7 @@ assets:
79
79
  _src: :href
80
80
  - name: mstile-icon-558x270.png
81
81
  convert:
82
- scale: 558x270
82
+ resize: 558x270
83
83
  refer:
84
84
  - browserconfig:
85
85
  msapplication:
@@ -90,7 +90,7 @@ assets:
90
90
  _src: :href
91
91
  - name: mstile-icon-558x558.png
92
92
  convert:
93
- scale: 558x558
93
+ resize: 558x558
94
94
  refer:
95
95
  - browserconfig:
96
96
  msapplication:
@@ -3,27 +3,26 @@ defaults: &defaults
3
3
  alpha: null
4
4
  background: null
5
5
  define: null
6
- density: null
7
6
  extent: null
8
7
  gravity: null
9
8
  resize: null
10
- scale: null
9
+ size: null
11
10
  .svg:
12
11
  .png:
13
12
  <<: *defaults
14
13
  background: :background
15
- density: :max
16
14
  extent: :auto
17
15
  gravity: center
18
- scale:
16
+ resize:
17
+ size: :auto
19
18
  .ico:
20
19
  <<: *defaults
21
20
  background: :background
22
21
  define:
23
- density: :max
24
22
  extent: :auto
25
23
  gravity: center
26
- scale:
24
+ resize:
25
+ size: :auto
27
26
  .svg:
28
27
  <<: *defaults
29
28
  .png:
@@ -30,11 +30,22 @@ module Jekyll
30
30
  end
31
31
  end
32
32
 
33
+ def convert_odd_source?
34
+ img = MiniMagick::Image.open path
35
+ Utils.odd? img.dimensions
36
+ end
37
+
38
+ def convert_size(size, separator = "x")
39
+ return size unless convert_odd_source? || Utils.odd?(size)
40
+ min_dimension = size.split(separator).min
41
+ [min_dimension, min_dimension].join(separator)
42
+ end
43
+
33
44
  def sizes
34
45
  if (match = Utils.name_to_size(name)) then [match[1]]
35
46
  elsif (define = Utils.define_to_size(convert_spec["define"])) then define
36
47
  elsif (resize = convert_spec["resize"]) then [resize]
37
- elsif (scale = convert_spec["scale"]) then [scale]
48
+ elsif (size = convert_spec["size"]) then [size]
38
49
  end
39
50
  end
40
51
 
@@ -88,20 +99,17 @@ module Jekyll
88
99
  end
89
100
 
90
101
  def convert_patch_options(options)
91
- %w[density extent].each_with_object(options) do |name, memo|
102
+ %w[size extent].each_with_object(options) do |name, memo|
92
103
  method = "convert_patch_option_#{name}".to_sym
93
104
  memo[name] = send(method, options[name])
94
105
  end
95
106
  end
96
107
 
97
- def convert_patch_option_density(density)
98
- case density
99
- when :max
100
- length = sizes.collect { |size| size.split("x").collect(&:to_i) }
101
- .flatten
102
- .max
103
- length * 3
104
- else density
108
+ def convert_patch_option_size(size)
109
+ case size
110
+ when :auto
111
+ convert_size size if (size = sizes.first)
112
+ else size
105
113
  end
106
114
  end
107
115
 
@@ -10,7 +10,7 @@ module Jekyll
10
10
  include StaticFile::Convertible
11
11
 
12
12
  def generable?
13
- convertible? && super
13
+ super && convertible?
14
14
  end
15
15
 
16
16
  def patch(configuration)
@@ -38,6 +38,11 @@ module Jekyll
38
38
  compactable = hash.slice(*keys)
39
39
  Utils.compact compactable
40
40
  end
41
+
42
+ def self.odd?(size, separator = "x")
43
+ size = size.split(separator) if size.is_a? String
44
+ size.uniq.size == 1
45
+ end
41
46
  end
42
47
  end
43
48
  end
@@ -18,7 +18,7 @@ module Jekyll
18
18
  end
19
19
 
20
20
  def self.convert_options(convert, options = {})
21
- priorities = %w[resize scale]
21
+ priorities = %w[resize size]
22
22
  convert_apply convert, options.slice(*priorities)
23
23
  common_options = options.reject { |key| priorities.include? key }
24
24
  convert_apply convert, common_options
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Favicon
5
- VERSION = "1.0.0-2"
5
+ VERSION = "1.0.0-3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-favicon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.2
4
+ version: 1.0.0.pre.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alvaro Faundez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2021-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest