module Sprockets::Mime
def encoding_for_mime_type(type)
Returns the correct encoding for a given mime type, while falling
def encoding_for_mime_type(type) encoding = Encoding::BINARY if type =~ %r{^(image|audio|video)/} encoding ||= default_external_encoding if respond_to?(:default_external_encoding) encoding end
def extension_for_mime_type(type)
def extension_for_mime_type(type) mime_types.key(type) end
def extension_for_mime_type(type)
def extension_for_mime_type(type) mime_types.index(type) end
def mime_types(ext = nil)
environment and those part of `Rack::Mime`.
Returns a `Hash` of registered mime types registered on the
def mime_types(ext = nil) if ext.nil? Rack::Mime::MIME_TYPES.merge(@mime_types) else ext = Sprockets::Utils.normalize_extension(ext) @mime_types[ext] || Rack::Mime::MIME_TYPES[ext] end end
def register_mime_type(mime_type, ext)
def register_mime_type(mime_type, ext) ext = Sprockets::Utils.normalize_extension(ext) @mime_types[ext] = mime_type end