Volt.MIME (Volt v0.14.10)

Copy Markdown View Source

Central MIME/content-type helpers used by Volt.

Most file extension lookups delegate to the MIME package. Volt keeps a small amount of policy here for browser module responses and asset classification so callers do not need to repeat content-type literals.

Summary

Functions

Return whether a path is a MIME-known, non-source static asset.

CSS content type used by Volt responses.

Return whether a content type should be treated as CSS.

JavaScript module content type used by Volt responses.

Return whether a content type should be treated as JavaScript.

Fallback binary content type.

Return the content type for a path.

Functions

asset?(path)

@spec asset?(String.t()) :: boolean()

Return whether a path is a MIME-known, non-source static asset.

css()

@spec css() :: String.t()

CSS content type used by Volt responses.

css?(content_type)

@spec css?(String.t() | nil) :: boolean()

Return whether a content type should be treated as CSS.

javascript()

@spec javascript() :: String.t()

JavaScript module content type used by Volt responses.

javascript?(content_type)

@spec javascript?(String.t() | nil) :: boolean()

Return whether a content type should be treated as JavaScript.

octet_stream()

@spec octet_stream() :: String.t()

Fallback binary content type.

type(path)

@spec type(String.t()) :: String.t()

Return the content type for a path.