jekyll-favicon 1.0.0.pre.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +3 -1
- data/.github/workflows/test.yml +5 -1
- data/.gitignore +1 -0
- data/CHANGELOG.md +18 -15
- data/README.md +20 -23
- data/config/jekyll/favicon/static_file/convertible.yml +5 -6
- data/config/jekyll/favicon.yml +9 -9
- data/lib/jekyll/favicon/configuration/defaults.rb +7 -2
- data/lib/jekyll/favicon/static_file/convertible.rb +18 -10
- data/lib/jekyll/favicon/static_file/mutable.rb +5 -5
- data/lib/jekyll/favicon/static_graphic_file.rb +1 -1
- data/lib/jekyll/favicon/utils/configuration/patch.rb +4 -4
- data/lib/jekyll/favicon/utils/convert.rb +1 -1
- data/lib/jekyll/favicon/utils/tag.rb +4 -2
- data/lib/jekyll/favicon/utils.rb +5 -0
- data/lib/jekyll/favicon/version.rb +1 -1
- data/lib/jekyll/favicon.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fefe82f2a327fcfc67e7f5fbee4fbdd14d95f00f4f03da72716c5c92fdd8102
|
4
|
+
data.tar.gz: e147f09714c3d78304c9138a3ef15c0720c1bdbf5d1073f3367a72d7ee4bc24d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 922f114d55014a2d0bd30973822a43c736d011d641bcdcb3c153e54c350526ea7ac0268a89d608e422d7ce7eeb324442da6b8adb7af82344a32ff58892520b7f
|
7
|
+
data.tar.gz: adb2ccbdf4659c83916e7bb2d00b308b8b700dd9f5cab297491c6d3d88842a6f721c854ba5d648bf83fb6a45265bcd6a1c19f8e42e28cb5b8eadce7243fc8970
|
data/.devcontainer/Dockerfile
CHANGED
@@ -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
|
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/.github/workflows/test.yml
CHANGED
@@ -32,7 +32,11 @@ jobs:
|
|
32
32
|
gemfile: jekyll36
|
33
33
|
- ruby-version: '3.0'
|
34
34
|
gemfile: jekyll37
|
35
|
+
- ruby-version: '3.1'
|
36
|
+
gemfile: jekyll36
|
37
|
+
- ruby-version: '3.1'
|
38
|
+
gemfile: jekyll37
|
35
39
|
|
36
40
|
gemfile: [ jekyll36, jekyll37, jekyll38, jekyll39, jekyll40, jekyll41, jekyll42 ]
|
37
41
|
os: [ ubuntu-latest ]
|
38
|
-
ruby-version: [ 2.6, 2.7, '3.0' ]
|
42
|
+
ruby-version: [ 2.6, 2.7, '3.0', '3.1' ]
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,13 +4,27 @@ All notable changes to Jekyll-Favicon will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## [1.1.0] - 2022-07-31
|
8
|
+
### Added
|
9
|
+
- Enable aliases when loading YAML
|
10
|
+
### Fixed
|
11
|
+
- Ruby 3.x kwargs compatibility
|
8
12
|
|
9
|
-
## [1.0.0
|
13
|
+
## [1.0.0] - 2021-08-13
|
14
|
+
### Added
|
15
|
+
- gitignore Gemfile.lock
|
16
|
+
- gitignore .jekyll-cache
|
17
|
+
- Add Test github action workflow
|
18
|
+
- Regenration
|
19
|
+
### Changed
|
20
|
+
- Move supported ruby versions to 2.5
|
21
|
+
- Update nokogiri, minitest, and minitest-hooks gemspec's development dependencies
|
22
|
+
- Update mini_magick gemspec's runtime dependencies
|
23
|
+
- Update travis rvm versions
|
24
|
+
- Rename Gem Push github action workflow
|
10
25
|
### Fixed
|
11
26
|
- mime time error when starting new project
|
12
|
-
|
13
|
-
## [1.0.0.pre.1] - 2021-05-26
|
27
|
+
- fix SVG to PNG quality
|
14
28
|
### Removed
|
15
29
|
- Delete Gemfile.lock
|
16
30
|
- Delete .ruby-version
|
@@ -19,17 +33,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
19
33
|
- Remove graphicmagick from travis config
|
20
34
|
- Remove travis-ci config
|
21
35
|
- Remove nokogiri gemspec development dependency
|
22
|
-
### Changed
|
23
|
-
- Move supported ruby versions to 2.5
|
24
|
-
- Update nokogiri, minitest, and minitest-hooks gemspec's development dependencies
|
25
|
-
- Update mini_magick gemspec's runtime dependencies
|
26
|
-
- Update travis rvm versions
|
27
|
-
- Rename Gem Push github action workflow
|
28
|
-
### Added
|
29
|
-
- gitignore Gemfile.lock
|
30
|
-
- gitignore .jekyll-cache
|
31
|
-
- Add Test github action workflow
|
32
|
-
- Regenration
|
33
36
|
|
34
37
|
## [0.2.9] - 2021-02-10
|
35
38
|
### Added
|
data/README.md
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
This [Jekyll](https://jekyllrb.com) plugin adds:
|
4
4
|
|
5
|
-
- a generator for
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
-
|
5
|
+
- a generator for favicons (ICO, PNG, SVG), [webmanifests]((https://developer.mozilla.org/en-US/docs/Web/Manifest)), and [browserconfig]((https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn320426%28v=vs.85%29)) files
|
6
|
+
- a tag for the rendinering of all the corresponding links and metadata needed
|
7
|
+
|
8
|
+
Tested with:
|
9
|
+
|
10
|
+
- Jekyll 3.6 to 3.7, ruby 2.6 to 2.7
|
11
|
+
- Jekyll 3.8 to 4.2, ruby 2.6 to 3.1
|
12
12
|
|
13
13
|
## Prerequisites
|
14
14
|
|
15
|
-
|
15
|
+
### [ImageMagick](http://www.imagemagick.org)
|
16
16
|
|
17
17
|
Check if it is already installed by running:
|
18
18
|
|
@@ -21,12 +21,16 @@ $ convert --version | grep Version
|
|
21
21
|
Version: ImageMagick 7.0.8-46 Q16 x86_64 2019-05-19 https://imagemagick.org
|
22
22
|
```
|
23
23
|
|
24
|
-
|
24
|
+
### [librsvg](https://gitlab.gnome.org/GNOME/librsvg) (optional)
|
25
|
+
|
26
|
+
If you are having pixeled icons or if you have a [problem converting SVG files](https://github.com/afaundez/jekyll-favicon/issues/9#issuecomment-473862194), you may need to install the package `librsvg2-bin`. For example, in Ubuntu/Debian systems:
|
25
27
|
|
26
28
|
```sh
|
27
29
|
sudo apt install librsvg2-bin
|
28
30
|
```
|
29
31
|
|
32
|
+
You may need to install `librsvg` before installing the RSVG renderer.
|
33
|
+
|
30
34
|
Check the devcontainer's [Dockerfile](.devcontainer/Dockerfile) for more practical details.
|
31
35
|
|
32
36
|
## Installation
|
@@ -34,19 +38,15 @@ Check the devcontainer's [Dockerfile](.devcontainer/Dockerfile) for more practic
|
|
34
38
|
Add this line to your application's Gemfile:
|
35
39
|
|
36
40
|
```ruby
|
37
|
-
gem 'jekyll-favicon', '~> 1.
|
41
|
+
gem 'jekyll-favicon', '~> 1.1.0', group: :jekyll_plugins
|
38
42
|
```
|
39
43
|
|
40
44
|
## Usage
|
41
45
|
|
42
|
-
If you are going to use this plugin in a hosted build/service, be sure that they include your plugins as part of the process. You can check [
|
43
|
-
|
44
|
-
As [Github Pages](https://pages.github.com) build doesn't load custom plugins, this plugin won't work. As an alternative, you can build your site and push all files (for example, build to `docs`, version it and push it, although this works only for project pages).
|
46
|
+
If you are going to use this plugin in a hosted build/service, be sure that they include your plugins as part of the process. You can check [gh-pages](/afaundez/jekyll-favicon/tree/gh-pages) branch for a working example.
|
45
47
|
|
46
|
-
|
48
|
+
As [Github Pages](https://pages.github.com) doesn't load custom plugins, this plugin won't be included on the build process. As a workaround, you can build your site and push all files (for example, build to `docs`, version it and push it, although this works only for project pages).
|
47
49
|
|
48
|
-
- Jekyll 3.6 to 3.7, ruby 2.6 to 2.7
|
49
|
-
- Jekyll 3.8 to 4.2, ruby 2.6 to 3.0
|
50
50
|
|
51
51
|
### Generator
|
52
52
|
|
@@ -116,12 +116,11 @@ The convert configuration is specific for each type of convertion: SVG to ICO/PN
|
|
116
116
|
|----------------|---------------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|
|
117
117
|
| 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
118
|
| 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) |
|
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) | |
|
121
120
|
| 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
121
|
| 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
122
|
| 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
|
-
|
|
123
|
+
| 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
124
|
|
126
125
|
Symbol values:
|
127
126
|
|
@@ -140,10 +139,8 @@ The refer configuration is a list of hashes with only one key, `webmanifest` or
|
|
140
139
|
|
141
140
|
If you want to add something, just make a PR. There is a lot to do:
|
142
141
|
|
143
|
-
-
|
144
|
-
-
|
145
|
-
- Encapsulate image conversion
|
146
|
-
- Tests everywhere
|
142
|
+
- Tests more cases
|
143
|
+
- Keep updated the favicons and files needed with modern browsers
|
147
144
|
|
148
145
|
## Contributing
|
149
146
|
|
@@ -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
|
-
|
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
|
-
|
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
|
-
|
24
|
+
resize:
|
25
|
+
size: :auto
|
27
26
|
.svg:
|
28
27
|
<<: *defaults
|
29
28
|
.png:
|
data/config/jekyll/favicon.yml
CHANGED
@@ -8,7 +8,7 @@ assets:
|
|
8
8
|
- name: favicon.ico
|
9
9
|
convert:
|
10
10
|
define: 'icon:auto-resize=36,24,16'
|
11
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
93
|
+
resize: 558x558
|
94
94
|
refer:
|
95
95
|
- browserconfig:
|
96
96
|
msapplication:
|
@@ -24,11 +24,16 @@ module Jekyll
|
|
24
24
|
def self.load_file(*parts)
|
25
25
|
path = Favicon::ROOT.join(*parts).to_s
|
26
26
|
path = "#{path}.yml"
|
27
|
-
|
27
|
+
# Handle Psych 3 and 4
|
28
|
+
begin
|
29
|
+
YAML.load_file path, aliases: true
|
30
|
+
rescue ArgumentError
|
31
|
+
YAML.load_file path
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
def self.define_defaults(base, method_name, &block)
|
31
|
-
base.define_singleton_method(
|
36
|
+
base.define_singleton_method(:defaults, &block)
|
32
37
|
define_method(method_name, &block)
|
33
38
|
end
|
34
39
|
|
@@ -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 (
|
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[
|
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
|
98
|
-
case
|
99
|
-
when :
|
100
|
-
|
101
|
-
|
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
|
|
@@ -15,11 +15,11 @@ module Jekyll
|
|
15
15
|
|
16
16
|
def mutation
|
17
17
|
refers = case @extname
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
when ".xml"
|
19
|
+
mutation_refers.select { |refer| refer.key? "browserconfig" }
|
20
|
+
else
|
21
|
+
mutation_refers.collect { |refer| refer["webmanifest"] }
|
22
|
+
.compact
|
23
23
|
end
|
24
24
|
patch(Utils.merge(*refers) || {})
|
25
25
|
end
|
@@ -12,10 +12,10 @@ module Jekyll
|
|
12
12
|
|
13
13
|
def self.patch_unknown(value_or_values, &block)
|
14
14
|
patch_method = case value_or_values
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
when Array then :patch_array
|
16
|
+
when Hash then :patch_hash
|
17
|
+
when Symbol, String then :patch_value
|
18
|
+
else return value_or_values
|
19
19
|
end
|
20
20
|
send patch_method, value_or_values, &block
|
21
21
|
end
|
@@ -18,7 +18,7 @@ module Jekyll
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.convert_options(convert, options = {})
|
21
|
-
priorities = %w[resize
|
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
|
@@ -24,7 +24,8 @@ module Jekyll
|
|
24
24
|
def self.mutate_iterator(key, value, memo)
|
25
25
|
if key.start_with? "__" then memo.text = value
|
26
26
|
elsif key.start_with? "_" then memo.add_attribute key[1..], value
|
27
|
-
else
|
27
|
+
else
|
28
|
+
Tag.mutate_xml Tag.mutate_find_or_create_element(memo, key), value
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -45,7 +46,8 @@ module Jekyll
|
|
45
46
|
if key.start_with? "__" then memo.text = value
|
46
47
|
elsif (child_key = key.match(/^_(.*)$/))
|
47
48
|
memo.add_attribute child_key[1], value
|
48
|
-
else
|
49
|
+
else
|
50
|
+
build_xml key, memo, value
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
data/lib/jekyll/favicon/utils.rb
CHANGED
data/lib/jekyll/favicon.rb
CHANGED
@@ -20,8 +20,8 @@ module Jekyll
|
|
20
20
|
|
21
21
|
def self.build_asset(site, attributes)
|
22
22
|
asset_class = case File.extname attributes["name"]
|
23
|
-
|
24
|
-
|
23
|
+
when ".ico", ".png", ".svg" then StaticGraphicFile
|
24
|
+
when ".webmanifest", ".json", ".xml" then StaticDataFile
|
25
25
|
end
|
26
26
|
asset_class&.new site, attributes
|
27
27
|
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.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alvaro Faundez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -195,9 +195,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
195
|
version: 2.5.0
|
196
196
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
|
-
- - "
|
198
|
+
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
200
|
+
version: '0'
|
201
201
|
requirements: []
|
202
202
|
rubyforge_project:
|
203
203
|
rubygems_version: 2.7.6.3
|