Module: EnvStyle::FaviconHelper

Defined in:
app/helpers/env_style/favicon_helper.rb

Overview

Mixed into the host application's views so a single line in the layout head emits the right for the resolved source and environment.

Instance Method Summary collapse

Instance Method Details

#env_style_favicon_tagsObject

Emits the favicon tag, or nothing when EnvStyle is disabled or no source icon can be found. The tag always points at the engine route; the controller decides whether to tint or stream the source untouched.



10
11
12
13
14
15
16
17
18
# File 'app/helpers/env_style/favicon_helper.rb', line 10

def env_style_favicon_tags
  return unless EnvStyle.config.enabled

  favicon = EnvStyle::Favicon.new(root: Rails.root)
  return unless favicon.available?

  href = favicon.format == EnvStyle::Favicon::PNG ? env_style.png_favicon_path : env_style.svg_favicon_path
  tag.link(rel: "icon", type: favicon.content_type, href: href)
end