jekyll-favicon 0.1.2 → 0.2.0
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/.rubocop.yml +5 -0
- data/.travis.yml +9 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +21 -5
- data/README.md +41 -7
- data/Rakefile +1 -1
- data/jekyll-favicon.gemspec +8 -5
- data/lib/jekyll-favicon.rb +11 -4
- data/lib/jekyll/favicon.rb +26 -0
- data/lib/jekyll/favicon/config/defaults.yml +45 -0
- data/lib/jekyll/favicon/generator.rb +86 -0
- data/lib/jekyll/favicon/hooks.rb +4 -0
- data/lib/jekyll/favicon/icon.rb +84 -0
- data/lib/jekyll/favicon/metadata.rb +20 -0
- data/lib/jekyll/favicon/tag.rb +25 -0
- data/lib/jekyll/favicon/templates/browserconfig.xml.erb +11 -0
- data/lib/jekyll/favicon/templates/chrome.html.erb +5 -0
- data/lib/jekyll/favicon/templates/classic.html.erb +6 -0
- data/lib/jekyll/favicon/templates/ie.html.erb +4 -0
- data/lib/jekyll/favicon/templates/manifest.webmanifest.erb +1 -0
- data/lib/jekyll/favicon/templates/safari.html.erb +5 -0
- data/lib/{jekyll-favicon → jekyll/favicon}/version.rb +1 -1
- data/lib/string.rb +14 -0
- metadata +56 -8
- data/lib/jekyll/tags/favicon.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 528cf7e662580cd58927a34caac7ca446e3fa3da
|
4
|
+
data.tar.gz: 2fb40f906fbab5874c093e49240a4b9f5bf88d7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 671a32b58b47a30456b958a0590d62fc763c863b7eb5388bceb90b729f40c0295ff1523ad96510f26ecb01af1002fc9708743a8e28a3989afefb6272a7d83073
|
7
|
+
data.tar.gz: db6f23034ea242288b71d8c24309875ca59e7caa26cea99e3f65fe96a251858b902ced10fe30023f9a338dad19bc29fd59bf3335215744030ab710a67d139882
|
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
+
- 2.5.0
|
4
5
|
- 2.4.3
|
5
|
-
|
6
|
+
- 2.3.6
|
7
|
+
- 2.2.9
|
8
|
+
- 2.1.10
|
9
|
+
before_install:
|
10
|
+
- sudo apt-get update
|
11
|
+
- sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev
|
12
|
+
- sudo apt-get install -qq graphicsmagick
|
13
|
+
- gem install bundler -v 1.16.1
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jekyll-favicon (0.
|
4
|
+
jekyll-favicon (0.2.0)
|
5
5
|
jekyll (~> 3.7)
|
6
|
+
mini_magick (~> 4.5)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
addressable (2.5.2)
|
11
12
|
public_suffix (>= 2.0.2, < 4.0)
|
13
|
+
ast (2.4.0)
|
12
14
|
colorator (1.1.0)
|
13
15
|
concurrent-ruby (1.0.5)
|
14
16
|
em-websocket (0.5.1)
|
@@ -39,27 +41,40 @@ GEM
|
|
39
41
|
listen (~> 3.0)
|
40
42
|
kramdown (1.16.2)
|
41
43
|
liquid (4.0.0)
|
42
|
-
listen (3.
|
44
|
+
listen (3.0.8)
|
43
45
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
44
46
|
rb-inotify (~> 0.9, >= 0.9.7)
|
45
|
-
ruby_dep (~> 1.2)
|
46
47
|
mercenary (0.3.6)
|
48
|
+
mini_magick (4.8.0)
|
47
49
|
minitest (5.11.3)
|
50
|
+
parallel (1.12.1)
|
51
|
+
parser (2.5.0.5)
|
52
|
+
ast (~> 2.4.0)
|
48
53
|
pathutil (0.16.1)
|
49
54
|
forwardable-extended (~> 2.6)
|
55
|
+
powerpack (0.1.1)
|
50
56
|
public_suffix (3.0.2)
|
57
|
+
rainbow (3.0.0)
|
51
58
|
rake (10.5.0)
|
52
59
|
rb-fsevent (0.10.3)
|
53
60
|
rb-inotify (0.9.10)
|
54
61
|
ffi (>= 0.5.0, < 2)
|
55
62
|
rouge (3.1.1)
|
56
|
-
|
63
|
+
rubocop (0.54.0)
|
64
|
+
parallel (~> 1.10)
|
65
|
+
parser (>= 2.5)
|
66
|
+
powerpack (~> 0.1)
|
67
|
+
rainbow (>= 2.2.2, < 4.0)
|
68
|
+
ruby-progressbar (~> 1.7)
|
69
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
70
|
+
ruby-progressbar (1.9.0)
|
57
71
|
safe_yaml (1.0.4)
|
58
|
-
sass (3.5.
|
72
|
+
sass (3.5.6)
|
59
73
|
sass-listen (~> 4.0.0)
|
60
74
|
sass-listen (4.0.0)
|
61
75
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
62
76
|
rb-inotify (~> 0.9, >= 0.9.7)
|
77
|
+
unicode-display_width (1.3.0)
|
63
78
|
|
64
79
|
PLATFORMS
|
65
80
|
ruby
|
@@ -69,6 +84,7 @@ DEPENDENCIES
|
|
69
84
|
jekyll-favicon!
|
70
85
|
minitest (~> 5.0)
|
71
86
|
rake (~> 10.0)
|
87
|
+
rubocop (~> 0.54.0, >= 0.54.0)
|
72
88
|
|
73
89
|
BUNDLED WITH
|
74
90
|
1.16.1
|
data/README.md
CHANGED
@@ -1,20 +1,45 @@
|
|
1
1
|
# Jekyll Favicon
|
2
2
|
|
3
|
-
This [Jekyll](https://jekyllrb.com) adds
|
3
|
+
This [Jekyll](https://jekyllrb.com) plugin adds:
|
4
4
|
|
5
|
-
|
5
|
+
- a generator for
|
6
|
+
- a `favicon.ico`
|
7
|
+
- multiple `favicon-[width]x[height].png`
|
8
|
+
- a [webmanifest](https://developer.mozilla.org/en-US/docs/Web/Manifest)
|
9
|
+
- a [browser configuration schema](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/platform-apis/dn320426%28v=vs.85%29)
|
10
|
+
- a tag to generate all the corresponding links and metadata needed in the head tag
|
11
|
+
|
12
|
+
Note: this project depends on [minimagick/minimagick](https://github.com/minimagick/minimagick/), which depends on [ImageMagick](https://imagemagick.org/) or [GraphicsMagick](http://www.graphicsmagick.org/).
|
6
13
|
|
7
14
|
## Installation
|
8
15
|
|
9
16
|
Add this line to your application's Gemfile:
|
10
17
|
|
11
18
|
```ruby
|
12
|
-
gem 'jekyll-favicon', '~> 0.
|
19
|
+
gem 'jekyll-favicon', '~> 0.2.0', group: :jekyll_plugins
|
13
20
|
```
|
14
21
|
|
15
22
|
## Usage
|
16
23
|
|
17
|
-
|
24
|
+
Note: this plugin does not work with the [github-pages](https://pages.github.com) build, but you can generate the site and push it.
|
25
|
+
|
26
|
+
### Generator
|
27
|
+
|
28
|
+
By installing the plugin, it will be automatically active. It will search for the file `/favicon.svg` and generate set of files in `/assets/images` and few more items at the site's root. It also will exclude the original sources from being copied as a regular static file.
|
29
|
+
|
30
|
+
You can override whit your sites's `_config.yml`:
|
31
|
+
|
32
|
+
```yaml
|
33
|
+
favicon:
|
34
|
+
source: custom-favicon-png-or.svg
|
35
|
+
path: /assets/img
|
36
|
+
```
|
37
|
+
|
38
|
+
This plugin works best if you use an SVG with a square viewbox as the source, but you can also use a PNG instead (at least 558x588). Check [favicon.svg](/test/fixtures/sites/minimal/favicon.svg) as an example.
|
39
|
+
|
40
|
+
### Favicon tag
|
41
|
+
|
42
|
+
To get the links and meta, just add the favicon tag `{{ favicon }}`. For example, on your `index.html`
|
18
43
|
|
19
44
|
```html
|
20
45
|
---
|
@@ -32,11 +57,16 @@ Just add the favicon tag `{{ favicon }}`. For example, on your `index.html`
|
|
32
57
|
|
33
58
|
## Development
|
34
59
|
|
35
|
-
If you want to add something, just make a PR. There is a lot to do
|
60
|
+
If you want to add something, just make a PR. There is a lot to do:
|
61
|
+
|
62
|
+
- Define and check SVG/PNG attributes before execute
|
63
|
+
- Review SVG to PNG conversion, it working as it is, but some parameters are hard coded and may only work with the samples
|
64
|
+
- Encapsulate image conversion
|
65
|
+
- Tests everywhere
|
36
66
|
|
37
67
|
## Contributing
|
38
68
|
|
39
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
69
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/afaundez/jekyll-favicon. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
40
70
|
|
41
71
|
## License
|
42
72
|
|
@@ -44,4 +74,8 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
44
74
|
|
45
75
|
## Code of Conduct
|
46
76
|
|
47
|
-
Everyone interacting in the Jekyll
|
77
|
+
Everyone interacting in the Jekyll Favicon project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/afaundez/jekyll-favicon/blob/master/CODE_OF_CONDUCT.md).
|
78
|
+
|
79
|
+
## Acknowledgments
|
80
|
+
|
81
|
+
Notoriously inspired by [jekyll/jekyll-seo-tag](https://github.com/jekyll/jekyll-seo-tag) and [jekyll/jekyll-sitemap](https://github.com/jekyll/jekyll-sitemap).
|
data/Rakefile
CHANGED
data/jekyll-favicon.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
lib = File.expand_path('
|
2
|
+
lib = File.expand_path('lib', __dir__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'jekyll
|
4
|
+
require 'jekyll/favicon/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'jekyll-favicon'
|
@@ -9,8 +9,9 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Alvaro Faundez']
|
10
10
|
spec.email = ['alvaro@faundez.net']
|
11
11
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
12
|
+
spec.summary = 'Jekyll plugin for favicon tag generation.'
|
13
|
+
spec.description = 'Jekyll-favicon is a jekyll plugin that adds the' \
|
14
|
+
' tag favicon, generating html tags for favicon.'
|
14
15
|
spec.homepage = 'https://github.com/afaundez/jekyll-favicon'
|
15
16
|
spec.license = 'MIT'
|
16
17
|
|
@@ -22,8 +23,10 @@ Gem::Specification.new do |spec|
|
|
22
23
|
spec.require_paths = ['lib']
|
23
24
|
|
24
25
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
25
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rubocop', '~> 0.54.0', '>= 0.54.0'
|
27
29
|
|
28
30
|
spec.add_runtime_dependency 'jekyll', '~> 3.7'
|
31
|
+
spec.add_runtime_dependency 'mini_magick', '~> 4.5'
|
29
32
|
end
|
data/lib/jekyll-favicon.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# rubocop:disable Naming/FileName
|
2
|
+
# rubocop:enable Naming/FileName
|
3
3
|
require 'jekyll'
|
4
|
-
|
5
|
-
require_relative '
|
4
|
+
require 'mini_magick'
|
5
|
+
require_relative 'string'
|
6
|
+
require_relative 'jekyll/favicon'
|
7
|
+
require_relative 'jekyll/favicon/version'
|
8
|
+
require_relative 'jekyll/favicon/hooks'
|
9
|
+
require_relative 'jekyll/favicon/metadata'
|
10
|
+
require_relative 'jekyll/favicon/icon'
|
11
|
+
require_relative 'jekyll/favicon/generator'
|
12
|
+
require_relative 'jekyll/favicon/tag'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Jekyll
|
4
|
+
# Module for custom configurations and defaults
|
5
|
+
module Favicon
|
6
|
+
GEM_ROOT = File.dirname File.dirname __dir__
|
7
|
+
PROJECT_LIB = File.join GEM_ROOT, 'lib'
|
8
|
+
PROJECT_ROOT = File.join PROJECT_LIB, 'jekyll', 'favicon'
|
9
|
+
defaults_path = File.join PROJECT_ROOT, 'config', 'defaults.yml'
|
10
|
+
DEFAULTS = YAML.load_file(defaults_path)['favicon']
|
11
|
+
|
12
|
+
# rubocop:disable Style/ClassVars
|
13
|
+
def self.merge(overrides)
|
14
|
+
@@config = Jekyll::Utils.deep_merge_hashes DEFAULTS, (overrides || {})
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.config
|
18
|
+
@@config ||= DEFAULTS
|
19
|
+
end
|
20
|
+
# rubocop:enable Style/ClassVars
|
21
|
+
|
22
|
+
def self.templates
|
23
|
+
File.join PROJECT_ROOT, 'templates'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
favicon:
|
2
|
+
source: favicon.svg
|
3
|
+
path: /assets/images
|
4
|
+
apple-touch-icon:
|
5
|
+
background: white
|
6
|
+
sizes:
|
7
|
+
- 57x57
|
8
|
+
- 76x76
|
9
|
+
- 120x120
|
10
|
+
- 152x152
|
11
|
+
- 167x167
|
12
|
+
- 180x180
|
13
|
+
safari-pinned-tab:
|
14
|
+
mask-icon-color: '#ffffff'
|
15
|
+
ie:
|
16
|
+
tile-color: '#ffffff'
|
17
|
+
sizes:
|
18
|
+
- 128x128
|
19
|
+
- 270x270
|
20
|
+
- 558x270
|
21
|
+
- 558x558
|
22
|
+
browserconfig-path: /
|
23
|
+
chrome:
|
24
|
+
sizes:
|
25
|
+
- 192x192
|
26
|
+
- 96x96
|
27
|
+
- 48x48
|
28
|
+
manifest-path: /
|
29
|
+
classic:
|
30
|
+
sizes:
|
31
|
+
- 16x16
|
32
|
+
- 32x32
|
33
|
+
- 64x64
|
34
|
+
- 144x144
|
35
|
+
svg:
|
36
|
+
density: 2000
|
37
|
+
dimensions: 1024x1024
|
38
|
+
png:
|
39
|
+
dimensions: 558x558
|
40
|
+
ico:
|
41
|
+
path: /
|
42
|
+
sizes:
|
43
|
+
- 48
|
44
|
+
- 32
|
45
|
+
- 16
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Favicon
|
3
|
+
# Extended generator that creates all the stastic icons and metadata files
|
4
|
+
class Generator < Jekyll::Generator
|
5
|
+
priority :high
|
6
|
+
|
7
|
+
def generate(site)
|
8
|
+
@site = site
|
9
|
+
if File.exist? favicon_source
|
10
|
+
generate_files Favicon.config['sizes'], Favicon.config['path']
|
11
|
+
else
|
12
|
+
Jekyll.logger.warn 'Jekyll::Favicon: Missing' \
|
13
|
+
" #{Favicon.config['source']}, not generating" \
|
14
|
+
' favicons.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def generate_files(sizes, prefix)
|
21
|
+
favicon_template = favicon_tempfile
|
22
|
+
generate_ico_from favicon_template.path
|
23
|
+
generate_png_from favicon_template.path, prefix, sizes
|
24
|
+
if File.extname(favicon_source) == '.svg'
|
25
|
+
generate_svg_from favicon_source, prefix,
|
26
|
+
'safari-pinned-tab.svg'
|
27
|
+
end
|
28
|
+
generate_metadata_from 'browserconfig.xml'
|
29
|
+
generate_metadata_from 'manifest.webmanifest'
|
30
|
+
end
|
31
|
+
|
32
|
+
def generate_ico_from(source)
|
33
|
+
ico_favicon = Icon.new(@site, '', 'favicon.ico', source)
|
34
|
+
@site.static_files << ico_favicon
|
35
|
+
end
|
36
|
+
|
37
|
+
def generate_png_from(source, prefix, sizes)
|
38
|
+
['classic', 'ie', 'chrome', 'apple-touch-icon'].each do |template|
|
39
|
+
Favicon.config[template]['sizes'].each do |size|
|
40
|
+
png_favicon = Icon.new(@site, prefix, "favicon-#{size}.png", source)
|
41
|
+
@site.static_files << png_favicon
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def generate_metadata_from(template)
|
47
|
+
metadata_page = Metadata.new(@site, @site.source, '', template)
|
48
|
+
@site.pages << metadata_page
|
49
|
+
end
|
50
|
+
|
51
|
+
def generate_svg_from(source, prefix, name)
|
52
|
+
svg_favicon = Icon.new(@site, prefix, name, source)
|
53
|
+
@site.static_files << svg_favicon
|
54
|
+
end
|
55
|
+
|
56
|
+
def favicon_source
|
57
|
+
File.join(*[@site.source, Favicon.config['source']].compact)
|
58
|
+
end
|
59
|
+
|
60
|
+
def favicon_tempfile
|
61
|
+
tempfile = Tempfile.new(['favicon_template', '.png'])
|
62
|
+
convert favicon_source, tempfile.path, Favicon.config
|
63
|
+
tempfile
|
64
|
+
end
|
65
|
+
|
66
|
+
def convert(source, output, options = {})
|
67
|
+
MiniMagick::Tool::Convert.new do |convert|
|
68
|
+
options_for convert, source, options
|
69
|
+
convert << favicon_source
|
70
|
+
convert << output
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def options_for(convert, source, options)
|
75
|
+
convert.flatten
|
76
|
+
convert.background 'none'
|
77
|
+
if source.svg?
|
78
|
+
convert.density options['svg']['density']
|
79
|
+
convert.resize options['svg']['dimensions']
|
80
|
+
elsif source.png?
|
81
|
+
convert.resize options['png']['dimensions']
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Favicon
|
3
|
+
# Extended static file that generates multpiple favicons
|
4
|
+
class Icon < Jekyll::StaticFile
|
5
|
+
attr_accessor :source
|
6
|
+
|
7
|
+
def initialize(site, dir, name, source, collection = nil)
|
8
|
+
@site = site
|
9
|
+
@base = @site.source
|
10
|
+
@dir = dir
|
11
|
+
@name = name
|
12
|
+
@source = source
|
13
|
+
@collection = collection
|
14
|
+
@relative_path = File.join(*[@dir, name].compact)
|
15
|
+
@extname = File.extname(@name)
|
16
|
+
@data = { 'name' => @name, 'layout' => nil }
|
17
|
+
end
|
18
|
+
|
19
|
+
def path
|
20
|
+
source
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def copy_file(dest_path)
|
26
|
+
case @extname
|
27
|
+
when '.svg' then FileUtils.cp path, dest_path
|
28
|
+
when '.ico' then convert path, dest_path, ico_options
|
29
|
+
when '.png' then convert path, dest_path, png_options
|
30
|
+
else Jekyll.logger.warn "Jekyll::Favicon: Can't generate" \
|
31
|
+
" #{dest_path}, extension not supported supported."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def dimensions
|
36
|
+
@name[/favicon-(\d+x\d+).png/, 1].split('x').collect(&:to_i)
|
37
|
+
end
|
38
|
+
|
39
|
+
def png_options
|
40
|
+
options = {}
|
41
|
+
options[:background] = Favicon.config['background']
|
42
|
+
w, h = dimensions
|
43
|
+
options[:odd] = w != h
|
44
|
+
options[:resize] = dimensions.join('x')
|
45
|
+
options
|
46
|
+
end
|
47
|
+
|
48
|
+
def ico_options
|
49
|
+
options = {}
|
50
|
+
options[:background] = Favicon.config['background']
|
51
|
+
ico_sizes = Favicon.config['ico']['sizes'].join ','
|
52
|
+
options[:define] = "icon:auto-resize=#{ico_sizes}"
|
53
|
+
options
|
54
|
+
end
|
55
|
+
|
56
|
+
def convert(input, output, options = {})
|
57
|
+
MiniMagick::Tool::Convert.new do |convert|
|
58
|
+
options_for convert, options
|
59
|
+
convert << input
|
60
|
+
convert << output
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def options_for(convert, options)
|
65
|
+
convert.flatten
|
66
|
+
convert.background background_for options[:resize]
|
67
|
+
convert.define options[:define] if options[:define]
|
68
|
+
return unless options[:resize]
|
69
|
+
convert.resize options[:resize]
|
70
|
+
return unless options[:odd]
|
71
|
+
convert.gravity 'center'
|
72
|
+
convert.extent options[:resize]
|
73
|
+
end
|
74
|
+
|
75
|
+
def background_for(size)
|
76
|
+
if Favicon.config['apple-touch-icon']['sizes'].include? size
|
77
|
+
Favicon.config['apple-touch-icon']['background']
|
78
|
+
else
|
79
|
+
'none'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Favicon
|
3
|
+
# Extended Page that generate files from ERB templates
|
4
|
+
class Metadata < Jekyll::Page
|
5
|
+
def initialize(site, base, dir, name)
|
6
|
+
@site = site
|
7
|
+
@base = base
|
8
|
+
@dir = dir
|
9
|
+
@name = name
|
10
|
+
|
11
|
+
process @name
|
12
|
+
template = File.read File.join Favicon.templates, "#{name}.erb"
|
13
|
+
self.content = ERB.new(template, nil, '-').result binding
|
14
|
+
self.data = {}
|
15
|
+
data['name'] = name
|
16
|
+
data['layout'] = nil
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Favicon
|
3
|
+
# New `favicon` tag for favicon include on templates
|
4
|
+
class Tag < Liquid::Tag
|
5
|
+
def initialize(tag_name, text, tokens)
|
6
|
+
super
|
7
|
+
@text = text
|
8
|
+
end
|
9
|
+
|
10
|
+
def render(context)
|
11
|
+
site = context.registers[:site]
|
12
|
+
templates_dir = Favicon.templates
|
13
|
+
head = "<!-- Begin Jekyll Favicon tag v#{Favicon::VERSION} -->"
|
14
|
+
body = %w[classic safari chrome ie].collect do |template|
|
15
|
+
template_path = File.join templates_dir, "#{template}.html.erb"
|
16
|
+
ERB.new(File.read(template_path), nil, '-').result(binding).strip
|
17
|
+
end
|
18
|
+
foot = '<!-- End Jekyll Favicon tag -->'
|
19
|
+
[head, body.join("\n"), foot].join("\n")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Liquid::Template.register_tag('favicon', Jekyll::Favicon::Tag)
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<browserconfig>
|
2
|
+
<msapplication>
|
3
|
+
<tile>
|
4
|
+
<square310x310logo src="<%= File.join Favicon.config['path'], 'favicon-558x558.png' %>" />
|
5
|
+
<wide310x150logo src="<%= File.join Favicon.config['path'], 'favicon-558x270.png' %>" />
|
6
|
+
<square150x150logo src="<%= File.join Favicon.config['path'], 'favicon-270x270.png' %>" />
|
7
|
+
<square70x70logo src="<%= File.join Favicon.config['path'], 'favicon-128x128.png' %>" />
|
8
|
+
<TileColor><%= Favicon.config['ie']['tile-color'] %></TileColor>
|
9
|
+
</tile>
|
10
|
+
</msapplication>
|
11
|
+
</browserconfig>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<!-- Chrome -->
|
2
|
+
<%- Favicon.config['chrome']['sizes'].each do |size| -%>
|
3
|
+
<link rel="icon" sizes="<%= size %>" href="<%= File.join Favicon.config['path'], "favicon-#{size}.png" %>">
|
4
|
+
<%- end -%>
|
5
|
+
<link rel="manifest" href="<%= File.join Favicon.config['chrome']['manifest-path'], 'manifest.webmanifest' %>">
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<!-- Classic -->
|
2
|
+
<link rel="shortcut icon" href="favicon.ico">
|
3
|
+
<link rel="icon" sizes="<%= Favicon.config['ico']['sizes'].collect{|s| "#{s}x#{s}"}.join ' ' %>" href="<%= File.join Favicon.config['ico']['path'], 'favicon.ico' %>">
|
4
|
+
<%- Favicon.config['classic']['sizes'].each do |size| -%>
|
5
|
+
<link rel="icon" sizes="<%= size %>" type="image/png" href="<%= File.join Favicon.config['path'], "favicon-#{size}.png" %>">
|
6
|
+
<%- end -%>
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<!-- IE -->
|
2
|
+
<meta name="msapplication-TileColor" content="<%= Favicon.config['ie']['tile-color'] %>">
|
3
|
+
<meta name="msapplication-TileImage" content="<%= File.join Favicon.config['path'], 'favicon-144x144.png' %>">
|
4
|
+
<meta name="msapplication-config" content="<%= File.join Favicon.config['ie']['browserconfig-path'], 'browserconfig.xml' %>">
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= JSON.pretty_generate icons: Favicon.config['chrome']['sizes'].collect{|size| {src: File.join(Favicon.config['path'], "favicon-#{size}.png"), type: 'png', sizes: size}} %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<!-- Safari -->
|
2
|
+
<%- Favicon.config['apple-touch-icon']['sizes'].each do |size| -%>
|
3
|
+
<link rel="apple-touch-icon" sizes="<%= size %>" href="<%= File.join Favicon.config['path'], "favicon-#{size}.png" %>">
|
4
|
+
<%- end -%>
|
5
|
+
<link rel="mask-icon" color="<%= Favicon.config['safari-pinned-tab']['mask-icon-color'] %>" href="<%= File.join Favicon.config['path'], 'safari-pinned-tab.svg' %>">
|
data/lib/string.rb
ADDED
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: 0.
|
4
|
+
version: 0.2.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: 2018-03-
|
11
|
+
date: 2018-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,19 +53,25 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '10.0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rubocop
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 0.54.0
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 0.54.0
|
48
65
|
type: :development
|
49
66
|
prerelease: false
|
50
67
|
version_requirements: !ruby/object:Gem::Requirement
|
51
68
|
requirements:
|
52
69
|
- - "~>"
|
53
70
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
71
|
+
version: 0.54.0
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 0.54.0
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
76
|
name: jekyll
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +86,20 @@ dependencies:
|
|
66
86
|
- - "~>"
|
67
87
|
- !ruby/object:Gem::Version
|
68
88
|
version: '3.7'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: mini_magick
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '4.5'
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '4.5'
|
69
103
|
description: Jekyll-favicon is a jekyll plugin that adds the tag favicon, generating
|
70
104
|
html tags for favicon.
|
71
105
|
email:
|
@@ -75,6 +109,7 @@ extensions: []
|
|
75
109
|
extra_rdoc_files: []
|
76
110
|
files:
|
77
111
|
- ".gitignore"
|
112
|
+
- ".rubocop.yml"
|
78
113
|
- ".travis.yml"
|
79
114
|
- CODE_OF_CONDUCT.md
|
80
115
|
- Gemfile
|
@@ -86,8 +121,21 @@ files:
|
|
86
121
|
- bin/setup
|
87
122
|
- jekyll-favicon.gemspec
|
88
123
|
- lib/jekyll-favicon.rb
|
89
|
-
- lib/jekyll
|
90
|
-
- lib/jekyll/
|
124
|
+
- lib/jekyll/favicon.rb
|
125
|
+
- lib/jekyll/favicon/config/defaults.yml
|
126
|
+
- lib/jekyll/favicon/generator.rb
|
127
|
+
- lib/jekyll/favicon/hooks.rb
|
128
|
+
- lib/jekyll/favicon/icon.rb
|
129
|
+
- lib/jekyll/favicon/metadata.rb
|
130
|
+
- lib/jekyll/favicon/tag.rb
|
131
|
+
- lib/jekyll/favicon/templates/browserconfig.xml.erb
|
132
|
+
- lib/jekyll/favicon/templates/chrome.html.erb
|
133
|
+
- lib/jekyll/favicon/templates/classic.html.erb
|
134
|
+
- lib/jekyll/favicon/templates/ie.html.erb
|
135
|
+
- lib/jekyll/favicon/templates/manifest.webmanifest.erb
|
136
|
+
- lib/jekyll/favicon/templates/safari.html.erb
|
137
|
+
- lib/jekyll/favicon/version.rb
|
138
|
+
- lib/string.rb
|
91
139
|
homepage: https://github.com/afaundez/jekyll-favicon
|
92
140
|
licenses:
|
93
141
|
- MIT
|
@@ -108,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
156
|
version: '0'
|
109
157
|
requirements: []
|
110
158
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
159
|
+
rubygems_version: 2.2.5
|
112
160
|
signing_key:
|
113
161
|
specification_version: 4
|
114
162
|
summary: Jekyll plugin for favicon tag generation.
|
data/lib/jekyll/tags/favicon.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module Jekyll
|
2
|
-
module Tags
|
3
|
-
class Favicon < Liquid::Tag
|
4
|
-
|
5
|
-
def initialize(tag_name, text, tokens)
|
6
|
-
super
|
7
|
-
@text = text
|
8
|
-
end
|
9
|
-
|
10
|
-
def render(context)
|
11
|
-
<<-HTML
|
12
|
-
<!-- Begin Jekyll Favicon tag v#{Jekyll::Favicon::VERSION} -->
|
13
|
-
<link href="/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180">
|
14
|
-
<link href="/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png">
|
15
|
-
<link href="/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png">
|
16
|
-
<link href="/manifest.json" rel="manifest">
|
17
|
-
<link color="#5bbad5" href="/safari-pinned-tab.svg" rel="mask-icon">
|
18
|
-
<meta content="#ffffff" name="theme-color" />
|
19
|
-
<!-- End Jekyll Favicon tag -->
|
20
|
-
HTML
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
Liquid::Template.register_tag('favicon', Jekyll::Tags::Favicon)
|