jekyll-favicon 0.2.4 → 0.2.5

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: 60af78377fc44dac79accf873d88e949337ea04f
4
- data.tar.gz: 799c1b14f8a640ec9a10b0fd064ba602cd6a45d9
3
+ metadata.gz: 0f9e788acfa22c8c2b0142764e25df5af99e5304
4
+ data.tar.gz: 026774aef1aeae4bdc655dc4d664fde79c96234b
5
5
  SHA512:
6
- metadata.gz: 6f20b3eee5cfe796557ed3f9159a40431eb265c916dea14d520732d8ef2a42c7f28008ac0798ff01261a9d10d4d0fcd047ac6d72c2e65722ba3171f3da534ef5
7
- data.tar.gz: 9c3db38ff17040cb371a9a75b05457f0eb098f87db95b7c000736093498500776cb55f775b9148f60937c22523e969d491772d18de6b992debae1226ad163123
6
+ metadata.gz: 384b59a8e14e74763c62ff19852965dbb3887b215769458b53d34c5a67aed74acf04e08173ad055bcbccf274823d08b02a25a0eb9aea96e096a4610e49778514
7
+ data.tar.gz: 7a96ad07d6411cb2590d993a3808fc970a356db6f50c02423c42c140f453c64c4d3cc85df874a7cf70399d7b7ff0fa822175a75ef7d575998697666458ccdddd
@@ -1,11 +1,15 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.0
5
- - 2.4.3
6
- - 2.3.6
7
- - 2.2.9
4
+ - 2.6.0
5
+ - 2.5.3
6
+ - 2.4.5
7
+ - 2.3.8
8
+ - 2.2.10
8
9
  - 2.1.10
10
+ - 2.1.0
11
+ before_install:
12
+ - if ! [[ `ruby -v | cut -d' ' -f2` > "2.3" ]]; then gem install bundler -v '< 2'; fi;
9
13
  addons:
10
14
  apt:
11
15
  config:
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.5] - 2019-01-16
10
+ ### Changed
11
+ - Strike GraphicsMagick at Readme because it's compatible a this moment
12
+ ### Fixed
13
+ - Skip safari pinned tab when source is not a SVG
14
+
9
15
  ## [0.2.4] - 2018-10-05
10
16
  ### Fixed
11
17
  - Path for favicon.ico in classic template
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll-favicon (0.2.4)
4
+ jekyll-favicon (0.2.5)
5
5
  jekyll (~> 3.0)
6
6
  mini_magick (~> 4.5)
7
7
 
@@ -12,17 +12,17 @@ GEM
12
12
  public_suffix (>= 2.0.2, < 4.0)
13
13
  ast (2.4.0)
14
14
  colorator (1.1.0)
15
- concurrent-ruby (1.0.5)
15
+ concurrent-ruby (1.1.4)
16
16
  em-websocket (0.5.1)
17
17
  eventmachine (>= 0.12.9)
18
18
  http_parser.rb (~> 0.6.0)
19
19
  eventmachine (1.2.7)
20
- ffi (1.9.25)
20
+ ffi (1.10.0)
21
21
  forwardable-extended (2.6.0)
22
22
  http_parser.rb (0.6.0)
23
23
  i18n (0.9.5)
24
24
  concurrent-ruby (~> 1.0)
25
- jekyll (3.8.4)
25
+ jekyll (3.8.5)
26
26
  addressable (~> 2.4)
27
27
  colorator (~> 1.0)
28
28
  em-websocket (~> 0.5)
@@ -40,7 +40,7 @@ GEM
40
40
  jekyll-watch (2.0.0)
41
41
  listen (~> 3.0)
42
42
  kramdown (1.17.0)
43
- liquid (4.0.0)
43
+ liquid (4.0.1)
44
44
  listen (3.0.8)
45
45
  rb-fsevent (~> 0.9, >= 0.9.4)
46
46
  rb-inotify (~> 0.9, >= 0.9.7)
@@ -48,12 +48,14 @@ GEM
48
48
  mini_magick (4.9.2)
49
49
  mini_portile2 (2.3.0)
50
50
  minitest (5.11.3)
51
+ minitest-hooks (1.5.0)
52
+ minitest (> 5.3)
51
53
  nokogiri (1.8.5)
52
54
  mini_portile2 (~> 2.3.0)
53
55
  parallel (1.12.1)
54
56
  parser (2.5.1.2)
55
57
  ast (~> 2.4.0)
56
- pathutil (0.16.1)
58
+ pathutil (0.16.2)
57
59
  forwardable-extended (~> 2.6)
58
60
  powerpack (0.1.2)
59
61
  public_suffix (3.0.3)
@@ -72,7 +74,7 @@ GEM
72
74
  unicode-display_width (~> 1.0, >= 1.0.1)
73
75
  ruby-progressbar (1.10.0)
74
76
  safe_yaml (1.0.4)
75
- sass (3.6.0)
77
+ sass (3.7.3)
76
78
  sass-listen (~> 4.0.0)
77
79
  sass-listen (4.0.0)
78
80
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -86,9 +88,10 @@ DEPENDENCIES
86
88
  bundler (~> 1.16)
87
89
  jekyll-favicon!
88
90
  minitest (~> 5.0)
91
+ minitest-hooks (~> 1.4, >= 1.4.2)
89
92
  nokogiri (~> 1.8)
90
93
  rake (~> 10.0)
91
94
  rubocop (~> 0.54.0, >= 0.54.0)
92
95
 
93
96
  BUNDLED WITH
94
- 1.16.1
97
+ 1.17.3
data/README.md CHANGED
@@ -9,11 +9,9 @@ This [Jekyll](https://jekyllrb.com) plugin adds:
9
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
10
  - a tag to generate all the corresponding links and metadata needed in the head tag
11
11
 
12
-
13
-
14
12
  ## Prerequisites
15
13
 
16
- Before using this plugin your system must have installed [ImageMagick](http://www.imagemagick.org) (or [GraphicsMagick](http://www.graphicsmagick.org/)).
14
+ Before using this plugin your system must have installed [ImageMagick](http://www.imagemagick.org) ~~(or [GraphicsMagick](http://www.graphicsmagick.org/))~~.
17
15
 
18
16
  Check if it is already installed by running:
19
17
 
@@ -31,7 +29,7 @@ Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
31
29
  Add this line to your application's Gemfile:
32
30
 
33
31
  ```ruby
34
- gem 'jekyll-favicon', '~> 0.2.4', group: :jekyll_plugins
32
+ gem 'jekyll-favicon', '~> 0.2.5', group: :jekyll_plugins
35
33
  ```
36
34
 
37
35
  ## Usage
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_development_dependency 'bundler', '~> 1.16'
28
28
  spec.add_development_dependency 'minitest', '~> 5.0'
29
+ spec.add_development_dependency 'minitest-hooks', '~> 1.4', '>= 1.4.2'
29
30
  spec.add_development_dependency 'nokogiri', '~> 1.8'
30
31
  spec.add_development_dependency 'rake', '~> 10.0'
31
32
  spec.add_development_dependency 'rubocop', '~> 0.54.0', '>= 0.54.0'
@@ -0,0 +1,54 @@
1
+ require 'rexml/document'
2
+
3
+ # Build browserconfig XML
4
+ class Browserconfig
5
+ attr_accessor :document
6
+
7
+ def load(source_path, config, prefix)
8
+ @document = if File.exist? source_path
9
+ REXML::Document.new File.read source_path
10
+ else
11
+ REXML::Document.new
12
+ end
13
+ add_browserconfig_schema
14
+ add_browserconfig_elements config, prefix
15
+ end
16
+
17
+ def add(path, element, attributes = {}, text = nil)
18
+ parent = @document.elements[path]
19
+ parent.elements[element] = REXML::Element.new element
20
+ attributes.each do |key, value|
21
+ parent.elements[element].add_attribute key, value
22
+ end
23
+ parent.add_text text if text
24
+ end
25
+
26
+ def dump
27
+ output = ''
28
+ formatter = REXML::Formatters::Pretty.new 2
29
+ formatter.compact = true
30
+ formatter.write @document, output
31
+ output
32
+ end
33
+
34
+ private
35
+
36
+ def add_browserconfig_schema
37
+ browserconfig = @document.elements['browserconfig']
38
+ browserconfig ||= @document.elements.add 'browserconfig'
39
+ msapplication = browserconfig.elements['msapplication']
40
+ msapplication ||= browserconfig.elements.add 'msapplication'
41
+ tile = msapplication.elements['tile']
42
+ tile || msapplication.elements.add('tile')
43
+ end
44
+
45
+ def add_browserconfig_elements(config, prefix)
46
+ path = 'browserconfig/msapplication/tile'
47
+ pathname = Pathname.new prefix
48
+ add path, 'square70x70logo', 'src' => pathname.join('favicon-128x128.png')
49
+ add path, 'square150x150logo', 'src' => pathname.join('favicon-270x270.png')
50
+ add path, 'wide310x150logo', 'src' => pathname.join('favicon-558x270.png')
51
+ add path, 'square310x310logo', 'src' => pathname.join('favicon-558x558.png')
52
+ add path, 'TileColor', {}, config['tile-color']
53
+ end
54
+ end
@@ -0,0 +1,12 @@
1
+ # Extend Hash with deep find of a key return array
2
+ class Hash
3
+ def deep_find(target)
4
+ keys.collect do |key|
5
+ if key == target
6
+ self[key]
7
+ elsif self[key].is_a? Hash
8
+ self[key].deep_find(target)
9
+ end
10
+ end.compact.flatten
11
+ end
12
+ end
@@ -0,0 +1,33 @@
1
+ # Build browserconfig XML
2
+ module Image
3
+ def self.convert(source, output, options = {})
4
+ MiniMagick::Tool::Convert.new do |convert|
5
+ options_for convert, options
6
+ convert << source
7
+ convert << output
8
+ end
9
+ end
10
+
11
+ def self.options_for(convert, options)
12
+ convert.flatten
13
+ basic_options convert, options
14
+ resize_options convert, options
15
+ odd_options convert, options
16
+ end
17
+
18
+ def self.basic_options(convert, options)
19
+ convert.background options[:background] if options[:background]
20
+ convert.define options[:define] if options[:define]
21
+ convert.density options[:density] if options[:density]
22
+ convert.alpha options[:alpha] if options[:alpha]
23
+ end
24
+
25
+ def self.resize_options(convert, options)
26
+ convert.resize options[:resize] if options[:resize]
27
+ end
28
+
29
+ def self.odd_options(convert, options)
30
+ convert.gravity 'center' if options[:odd]
31
+ convert.extent options[:resize] if options[:odd] && options[:resize]
32
+ end
33
+ end
@@ -3,6 +3,10 @@
3
3
  require 'jekyll'
4
4
  require 'mini_magick'
5
5
  require_relative 'string'
6
+ require_relative 'hash'
7
+ require_relative 'browserconfig'
8
+ require_relative 'webmanifest'
9
+ require_relative 'image'
6
10
  require_relative 'jekyll/favicon'
7
11
  require_relative 'jekyll/favicon/version'
8
12
  require_relative 'jekyll/favicon/hooks'
@@ -1,6 +1,7 @@
1
1
  favicon:
2
2
  source: favicon.svg
3
3
  path: /assets/images
4
+ background: white
4
5
  apple-touch-icon:
5
6
  background: white
6
7
  sizes:
@@ -19,13 +20,21 @@ favicon:
19
20
  - 270x270
20
21
  - 558x270
21
22
  - 558x558
22
- browserconfig-path: /
23
+ browserconfig:
24
+ source: browserconfig.xml
25
+ target: browserconfig.xml
23
26
  chrome:
24
27
  sizes:
25
28
  - 192x192
26
29
  - 96x96
27
30
  - 48x48
28
- manifest-path: /
31
+ manifest:
32
+ source: manifest.webmanifest
33
+ target: manifest.webmanifest
34
+ sizes:
35
+ - 192x192
36
+ - 96x96
37
+ - 48x48
29
38
  classic:
30
39
  sizes:
31
40
  - 16x16
@@ -38,8 +47,8 @@ favicon:
38
47
  png:
39
48
  dimensions: 558x558
40
49
  ico:
41
- path: /
50
+ target: favicon.ico
42
51
  sizes:
43
- - 48
44
- - 32
45
- - 16
52
+ - 48x48
53
+ - 32x32
54
+ - 16x16
@@ -8,86 +8,74 @@ module Jekyll
8
8
 
9
9
  def generate(site)
10
10
  @site = site
11
- if File.exist? favicon_source
12
- @template = favicon_tempfile
13
- generate_files Favicon.config['path']
11
+ if File.file? source_path Favicon.config['source']
12
+ @template = favicon_tempfile source_path Favicon.config['source']
13
+ generate_icons && generate_metadata
14
14
  else
15
- Jekyll.logger.warn 'Jekyll::Favicon: Missing' \
16
- " #{Favicon.config['source']}, not generating" \
17
- ' favicons.'
15
+ Jekyll.logger.warn 'Jekyll::Favicon: Missing ' \
16
+ "#{Favicon.config['source']}, not generating " \
17
+ 'favicons.'
18
18
  end
19
19
  end
20
20
 
21
21
  def clean
22
- return unless @tempfile
22
+ return unless @template
23
23
  @template.close
24
24
  @template.unlink
25
25
  end
26
26
 
27
27
  private
28
28
 
29
- def generate_files(prefix)
30
- generate_ico_from @template.path
31
- generate_png_from @template.path, prefix
32
- if File.extname(favicon_source) == '.svg'
33
- generate_svg_from favicon_source, prefix,
34
- 'safari-pinned-tab.svg'
35
- end
36
- generate_metadata_from 'browserconfig.xml'
37
- generate_metadata_from 'manifest.webmanifest'
38
- end
39
-
40
- def generate_ico_from(source)
41
- ico_favicon = Icon.new(@site, '', 'favicon.ico', source)
42
- @site.static_files << ico_favicon
29
+ def source_path(path = nil)
30
+ File.join(*[@site.source, path].compact)
43
31
  end
44
32
 
45
- def generate_png_from(source, prefix)
46
- ['classic', 'ie', 'chrome', 'apple-touch-icon'].each do |template|
47
- Favicon.config[template]['sizes'].each do |size|
48
- png_favicon = Icon.new(@site, prefix, "favicon-#{size}.png", source)
49
- @site.static_files << png_favicon
50
- end
33
+ def favicon_tempfile(source)
34
+ tempfile = Tempfile.new(['favicon-template', '.png'])
35
+ options = { background: 'none' }
36
+ if source.svg?
37
+ options[:density] = Favicon.config['svg']['density']
38
+ options[:resize] = Favicon.config['svg']['dimensions']
39
+ elsif source.png?
40
+ options[:resize] = Favicon.config['png']['dimensions']
51
41
  end
42
+ Image.convert source, tempfile.path, options
43
+ tempfile
52
44
  end
53
45
 
54
- def generate_metadata_from(template)
55
- metadata_page = Metadata.new(@site, @site.source, '', template)
56
- @site.pages << metadata_page
57
- end
58
-
59
- def generate_svg_from(source, prefix, name)
60
- svg_favicon = Icon.new(@site, prefix, name, source)
61
- @site.static_files << svg_favicon
46
+ def generate_icons
47
+ @site.static_files.push ico_icon
48
+ @site.static_files.push(*png_icons)
62
49
  end
63
50
 
64
- def favicon_source
65
- File.join(*[@site.source, Favicon.config['source']].compact)
51
+ def ico_icon
52
+ target = Favicon.config['ico']['target']
53
+ Icon.new @site, Favicon.config['source'], @template.path, target
66
54
  end
67
55
 
68
- def favicon_tempfile
69
- tempfile = Tempfile.new(['favicon_template', '.png'])
70
- convert favicon_source, tempfile.path, Favicon.config
71
- tempfile
56
+ def png_icons
57
+ Favicon.config.deep_find('sizes').uniq.collect do |size|
58
+ target = File.join Favicon.config['path'], "favicon-#{size}.png"
59
+ Icon.new @site, Favicon.config['source'], @template.path, target
60
+ end
72
61
  end
73
62
 
74
- def convert(source, output, options = {})
75
- MiniMagick::Tool::Convert.new do |convert|
76
- options_for convert, source, options
77
- convert << favicon_source
78
- convert << output
79
- end
63
+ def generate_metadata
64
+ @site.pages.push metadata Browserconfig.new,
65
+ Favicon.config['ie']['browserconfig']
66
+ @site.pages.push metadata Webmanifest.new,
67
+ Favicon.config['chrome']['manifest']
80
68
  end
81
69
 
82
- def options_for(convert, source, options)
83
- convert.flatten
84
- convert.background 'none'
85
- if source.svg?
86
- convert.density options['svg']['density']
87
- convert.resize options['svg']['dimensions']
88
- elsif source.png?
89
- convert.resize options['png']['dimensions']
90
- end
70
+ def metadata(document, config)
71
+ page = Metadata.new @site, @site.source,
72
+ File.dirname(config['target']),
73
+ File.basename(config['target'])
74
+ favicon_path = File.join (@site.baseurl || ''), Favicon.config['path']
75
+ document.load source_path(config['source']), config, favicon_path
76
+ page.content = document.dump
77
+ page.data = { 'layout' => nil }
78
+ page
91
79
  end
92
80
  end
93
81
  end
@@ -1,6 +1,9 @@
1
1
  Jekyll::Hooks.register :site, :after_init do |site|
2
2
  Jekyll::Favicon.merge site.config['favicon']
3
- site.config['exclude'] << Jekyll::Favicon.config['source']
3
+ favicon_config = Jekyll::Favicon.config
4
+ site.config['exclude'] << favicon_config['source']
5
+ site.config['exclude'] << favicon_config['chrome']['manifest']['source']
6
+ site.config['exclude'] << favicon_config['ie']['browserconfig']['source']
4
7
  end
5
8
 
6
9
  Jekyll::Hooks.register :site, :post_write do |site|
@@ -2,44 +2,52 @@ module Jekyll
2
2
  module Favicon
3
3
  # Extended static file that generates multpiple favicons
4
4
  class Icon < Jekyll::StaticFile
5
- attr_accessor :source
5
+ attr_accessor :replica
6
+ attr_accessor :target
6
7
 
7
- def initialize(site, dir, name, source, collection = nil)
8
+ def initialize(site, source, replica, target, collection = nil)
8
9
  @site = site
9
10
  @base = @site.source
10
- @dir = dir
11
- @name = name
12
- @source = source
11
+ @dir = File.dirname source
12
+ @name = File.basename source
13
+ @replica = replica
14
+ @target = target
13
15
  @collection = collection
14
- @relative_path = File.join(*[@dir, name].compact)
15
- @extname = File.extname(@name)
16
- @data = { 'name' => @name, 'layout' => nil }
16
+ @relative_path = File.join(*[@dir, @name].compact)
17
+ @extname = File.extname(target)
18
+ @data = { 'name' => File.basename(target), 'layout' => nil }
17
19
  end
18
20
 
19
- def path
20
- source
21
+ def destination(dest)
22
+ basename = File.basename(@target)
23
+ @site.in_dest_dir(*[dest, destination_rel_dir, basename].compact)
24
+ end
25
+
26
+ def destination_rel_dir
27
+ File.dirname @target
21
28
  end
22
29
 
23
30
  private
24
31
 
25
32
  def copy_file(dest_path)
26
33
  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
34
+ when '.svg' then FileUtils.cp @replica, dest_path
35
+ when '.ico' then Image.convert @replica, dest_path, ico_options
36
+ when '.png' then Image.convert @replica, dest_path, png_options
30
37
  else Jekyll.logger.warn "Jekyll::Favicon: Can't generate" \
31
38
  " #{dest_path}, extension not supported supported."
32
39
  end
33
40
  end
34
41
 
35
42
  def dimensions
36
- @name[/favicon-(\d+x\d+).png/, 1].split('x').collect(&:to_i)
43
+ basename = File.basename(@target)
44
+ basename[/favicon-(\d+x\d+).png/, 1].split('x').collect(&:to_i)
37
45
  end
38
46
 
39
47
  def png_options
40
48
  options = {}
41
- options[:background] = Favicon.config['background']
42
49
  w, h = dimensions
50
+ options[:background] = background_for dimensions
43
51
  options[:odd] = w != h
44
52
  options[:resize] = dimensions.join('x')
45
53
  options
@@ -47,37 +55,19 @@ module Jekyll
47
55
 
48
56
  def ico_options
49
57
  options = {}
50
- options[:background] = Favicon.config['background']
51
- ico_sizes = Favicon.config['ico']['sizes'].join ','
58
+ sizes = Favicon.config['ico']['sizes']
59
+ options[:background] = background_for sizes.first
60
+ options[:alpha] = 'off'
61
+ options[:resize] = sizes.first
62
+ ico_sizes = sizes.collect { |size| size.split('x').first }.join ','
52
63
  options[:define] = "icon:auto-resize=#{ico_sizes}"
53
64
  options
54
65
  end
55
66
 
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
67
  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
68
+ category = Favicon.config['apple-touch-icon']
69
+ return category['background'] if category['sizes'].include? size
70
+ Favicon.config['background']
81
71
  end
82
72
  end
83
73
  end
@@ -2,18 +2,11 @@ module Jekyll
2
2
  module Favicon
3
3
  # Extended Page that generate files from ERB templates
4
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
- prepend_path = @site.baseurl || ''
13
- template = File.read File.join Favicon.templates, "#{name}.erb"
14
- self.content = ERB.new(template, nil, '-').result binding
15
- self.data = { 'name' => name, 'layout' => nil }
5
+ # rubocop:disable Naming/MemoizedInstanceVariableName
6
+ def read_yaml(*)
7
+ @data ||= {}
16
8
  end
9
+ # rubocop:enable Naming/MemoizedInstanceVariableName
17
10
  end
18
11
  end
19
12
  end
@@ -2,4 +2,4 @@
2
2
  <%- Favicon.config['chrome']['sizes'].each do |size| -%>
3
3
  <link rel="icon" sizes="<%= size %>" href="<%= File.join prepend_path, Favicon.config['path'], "favicon-#{size}.png" %>">
4
4
  <%- end -%>
5
- <link rel="manifest" href="<%= File.join prepend_path, Favicon.config['chrome']['manifest-path'], 'manifest.webmanifest' %>">
5
+ <link rel="manifest" href="<%= File.join prepend_path, Favicon.config['chrome']['manifest']['target'] %>">
@@ -1,7 +1,7 @@
1
1
  <!-- Classic -->
2
- <%- favicon_ico_path = File.join prepend_path, Favicon.config['ico']['path'] -%>
3
- <link rel="shortcut icon" href="<%= File.join favicon_ico_path, 'favicon.ico' %>">
4
- <link rel="icon" sizes="<%= Favicon.config['ico']['sizes'].collect{|s| "#{s}x#{s}"}.join ' ' %>" href="<%= File.join favicon_ico_path, 'favicon.ico' %>">
2
+ <%- favicon_ico_path = File.join prepend_path, Favicon.config['ico']['target'] -%>
3
+ <link rel="shortcut icon" href="<%= favicon_ico_path %>">
4
+ <link rel="icon" sizes="<%= Favicon.config['ico']['sizes'].join ' ' %>" href="<%= favicon_ico_path %>">
5
5
  <%- favicon_path = File.join prepend_path, Favicon.config['path'] -%>
6
6
  <%- Favicon.config['classic']['sizes'].each do |size| -%>
7
7
  <link rel="icon" sizes="<%= size %>" type="image/png" href="<%= File.join favicon_path, "favicon-#{size}.png" %>">
@@ -1,4 +1,4 @@
1
1
  <!-- IE -->
2
2
  <meta name="msapplication-TileColor" content="<%= Favicon.config['ie']['tile-color'] %>">
3
3
  <meta name="msapplication-TileImage" content="<%= File.join prepend_path, Favicon.config['path'], 'favicon-144x144.png' %>">
4
- <meta name="msapplication-config" content="<%= File.join prepend_path, Favicon.config['ie']['browserconfig-path'], 'browserconfig.xml' %>">
4
+ <meta name='msapplication-config' content="<%= File.join prepend_path, Favicon.config['ie']['browserconfig']['target'] %>">
@@ -3,4 +3,6 @@
3
3
  <%- Favicon.config['apple-touch-icon']['sizes'].each do |size| -%>
4
4
  <link rel="apple-touch-icon" sizes="<%= size %>" href="<%= File.join favicon_path, "favicon-#{size}.png" %>">
5
5
  <%- end -%>
6
+ <% if Favicon.config['source'].svg? %>
6
7
  <link rel="mask-icon" color="<%= Favicon.config['safari-pinned-tab']['mask-icon-color'] %>" href="<%= File.join favicon_path, 'safari-pinned-tab.svg' %>">
8
+ <% end %>
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Favicon
3
- VERSION = '0.2.4'.freeze
3
+ VERSION = '0.2.5'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,30 @@
1
+ # Build Webmanifest JSON
2
+ class Webmanifest
3
+ attr_accessor :document
4
+
5
+ def load(source_path, config, prefix)
6
+ @document = if File.exist? source_path
7
+ JSON.parse File.read source_path
8
+ else
9
+ {}
10
+ end
11
+ add_webmanifest_elements config, prefix
12
+ end
13
+
14
+ def dump
15
+ JSON.pretty_generate document
16
+ end
17
+
18
+ private
19
+
20
+ def add_webmanifest_elements(config, prefix)
21
+ icons = config['sizes'].collect do |size|
22
+ {
23
+ src: File.join(prefix, "favicon-#{size}.png"),
24
+ type: 'png',
25
+ sizes: size
26
+ }
27
+ end
28
+ @document = Jekyll::Utils.deep_merge_hashes @document, icons: icons
29
+ end
30
+ 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: 0.2.4
4
+ version: 0.2.5
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-10-05 00:00:00.000000000 Z
11
+ date: 2019-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,26 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest-hooks
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.4'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.4.2
51
+ type: :development
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.4'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.4.2
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: nokogiri
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +159,9 @@ files:
139
159
  - bin/console
140
160
  - bin/setup
141
161
  - jekyll-favicon.gemspec
162
+ - lib/browserconfig.rb
163
+ - lib/hash.rb
164
+ - lib/image.rb
142
165
  - lib/jekyll-favicon.rb
143
166
  - lib/jekyll/favicon.rb
144
167
  - lib/jekyll/favicon/config/defaults.yml
@@ -147,14 +170,13 @@ files:
147
170
  - lib/jekyll/favicon/icon.rb
148
171
  - lib/jekyll/favicon/metadata.rb
149
172
  - lib/jekyll/favicon/tag.rb
150
- - lib/jekyll/favicon/templates/browserconfig.xml.erb
151
173
  - lib/jekyll/favicon/templates/chrome.html.erb
152
174
  - lib/jekyll/favicon/templates/classic.html.erb
153
175
  - lib/jekyll/favicon/templates/ie.html.erb
154
- - lib/jekyll/favicon/templates/manifest.webmanifest.erb
155
176
  - lib/jekyll/favicon/templates/safari.html.erb
156
177
  - lib/jekyll/favicon/version.rb
157
178
  - lib/string.rb
179
+ - lib/webmanifest.rb
158
180
  homepage: https://github.com/afaundez/jekyll-favicon
159
181
  licenses:
160
182
  - MIT
@@ -1,12 +0,0 @@
1
- <browserconfig>
2
- <msapplication>
3
- <tile>
4
- <%- favicon_path = File.join prepend_path, Favicon.config['path'] -%>
5
- <square310x310logo src="<%= File.join favicon_path, 'favicon-558x558.png' %>" />
6
- <wide310x150logo src="<%= File.join favicon_path, 'favicon-558x270.png' %>" />
7
- <square150x150logo src="<%= File.join favicon_path, 'favicon-270x270.png' %>" />
8
- <square70x70logo src="<%= File.join favicon_path, 'favicon-128x128.png' %>" />
9
- <TileColor><%= Favicon.config['ie']['tile-color'] %></TileColor>
10
- </tile>
11
- </msapplication>
12
- </browserconfig>
@@ -1 +0,0 @@
1
- <%= JSON.pretty_generate icons: Favicon.config['chrome']['sizes'].collect{|size| {src: File.join(prepend_path, Favicon.config['path'], "favicon-#{size}.png"), type: 'png', sizes: size}} %>