Sha256: a92f1271b36908725147750fe460465e1eb2992b8bfa893d230ad215b7f3d719
Contents?: true
Size: 688 Bytes
Versions: 4
Compression:
Stored size: 688 Bytes
Contents
module Locomotive::Wagon class Server class DynamicAssets < Middleware def call(env) self.set_accessors(env) path = env['PATH_INFO'] if path =~ /^\/(stylesheets|javascripts)\// mime_type = MIME::Types.type_for(path).first.try(:to_s) || 'text/plain' asset = self.mounting_point.theme_assets.detect do |_asset| _asset.path == path end if asset [200, { 'Content-Type' => mime_type }, [asset.content!]] else [404, { 'Content-Type' => mime_type }, ['Asset not found']] end else app.call(env) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems