Module: Athar::AssetHelper
- Defined in:
- app/helpers/athar/asset_helper.rb
Overview
Resolves the URL for a dashboard asset (‘dashboard.js`, `dashboard.css`).
When the host has Sprockets or Propshaft loaded, the asset pipeline serves the digested file from ‘app/assets/javascripts,stylesheets/athar/`. Otherwise we fall through to `/athar-assets/<version>/<name>`, which the `Athar::Middleware::AssetServer` middleware serves directly out of the same `app/assets/` source files.
Instance Method Summary collapse
Instance Method Details
#athar_asset_path(name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/athar/asset_helper.rb', line 12 def athar_asset_path(name) if defined?(::Sprockets) || defined?(::Propshaft) begin return ActionController::Base.helpers.asset_path("athar/#{name}") rescue StandardError => e Rails.logger&.warn("[Athar] asset_path fallback for #{name}: #{e.}") end end "/athar-assets/#{Athar::VERSION}/#{name}" end |
#athar_csp_nonce ⇒ Object
24 25 26 |
# File 'app/helpers/athar/asset_helper.rb', line 24 def athar_csp_nonce respond_to?(:content_security_policy_nonce) ? content_security_policy_nonce : nil end |