Class: Abqari::Manifest
- Inherits:
-
Object
- Object
- Abqari::Manifest
- Defined in:
- lib/abqari/manifest.rb
Overview
Web App Manifest writer. Emits _site/manifest.json from site config.
Linked from
public/, so the values stay in sync with site.yml
(title, theme color, etc.) without manual duplication.
Override any field via manifest: in config/site.yml; the rest fall
back to sensible defaults derived from other config keys.
Constant Summary collapse
- DEFAULTS =
{ 'display' => 'standalone', 'start_url' => '/', 'theme_color' => '#ffffff', 'background_color' => '#ffffff' }.freeze
- DEFAULT_ICONS =
[ { 'src' => '/icon-192.png', 'sizes' => '192x192', 'type' => 'image/png' }, { 'src' => '/icon-512.png', 'sizes' => '512x512', 'type' => 'image/png' } ].freeze
Instance Method Summary collapse
-
#initialize(site) ⇒ Manifest
constructor
A new instance of Manifest.
- #write ⇒ Object
Constructor Details
#initialize(site) ⇒ Manifest
Returns a new instance of Manifest.
27 28 29 30 |
# File 'lib/abqari/manifest.rb', line 27 def initialize(site) @site = site @cfg = site.config['manifest'] || {} end |
Instance Method Details
#write ⇒ Object
32 33 34 |
# File 'lib/abqari/manifest.rb', line 32 def write File.write(File.join(@site.output_dir, 'manifest.json'), JSON.pretty_generate(payload)) end |