Module: StudioThemeHelper

Defined in:
app/helpers/studio_theme_helper.rb

Instance Method Summary collapse

Instance Method Details

#studio_theme_css_tagObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/helpers/studio_theme_helper.rb', line 2

def studio_theme_css_tag
  css = Rails.cache.fetch("studio/theme/#{Studio.app_name}", expires_in: 1.hour) do
    colors = begin
      ThemeSetting.current.resolved_colors
    rescue ActiveRecord::StatementInvalid
      # Table doesn't exist yet (pre-migration) — use config defaults
      Studio.theme_config
    end
    Studio::ThemeResolver.new(colors).to_css
  end

  tag.style(css.html_safe, nonce: content_security_policy_nonce)
end