module Middleman::CoreExtensions::Request::InstanceMethods
def send_file(path, env, res)
-
path
(String
) -- File to send
def send_file(path, env, res) extension = File.extname(path) matched_mime = mime_type(extension) matched_mime = "application/octet-stream" if matched_mime.nil? content_type res, matched_mime file = ::Rack::File.new nil file.path = path response = file.serving(env) response[1]['Content-Encoding'] = 'gzip' if %w(.svgz).include?(extension) halt response end