Sha256: 010ae876e3f04e0d72c3cb8d49a90ed233de9b81a23fa468d834980653db7647

Contents?: true

Size: 675 Bytes

Versions: 5

Compression:

Stored size: 675 Bytes

Contents

# Build Webmanifest JSON
class Webmanifest
  attr_accessor :document

  def load(source_path, config, prefix)
    @document = if File.exist? source_path
                  JSON.parse File.read source_path
                else
                  {}
                end
    add_webmanifest_elements config, prefix
  end

  def dump
    JSON.pretty_generate document
  end

  private

  def add_webmanifest_elements(config, prefix)
    icons = config['sizes'].collect do |size|
      {
        src: File.join(prefix, "favicon-#{size}.png"),
        type: 'png',
        sizes: size
      }
    end
    @document = Jekyll::Utils.deep_merge_hashes @document, icons: icons
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jekyll-favicon-0.2.9 lib/webmanifest.rb
jekyll-favicon-0.2.8 lib/webmanifest.rb
jekyll-favicon-0.2.7 lib/webmanifest.rb
jekyll-favicon-0.2.6 lib/webmanifest.rb
jekyll-favicon-0.2.5 lib/webmanifest.rb