Sha256: c1394d2e2ae9164b6d94739025cefde0d2b9b445ad48dea198ad58e2417faa00
Contents?: true
Size: 751 Bytes
Versions: 4
Compression:
Stored size: 751 Bytes
Contents
# frozen_string_literal: true require "rack/file" module ServiceWorker module Rails class Handler def call(env) path_info = env.fetch("serviceworker.asset_name") if config.compile sprockets_server.call(env.merge("PATH_INFO" => path_info)) else file_server.call(env.merge("PATH_INFO" => asset_path(path_info))) end end private def sprockets_server ::Rails.application.assets end def file_server @file_server ||= ::Rack::File.new(::Rails.public_path) end def config ::Rails.configuration.assets end def asset_path(path) ::ActionController::Base.helpers.asset_path(path) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems