# `Volt.Assets`
[🔗](https://github.com/elixir-volt/volt/blob/v0.10.1/lib/volt/assets.ex#L1)

Static asset handling — images, fonts, SVGs, and other non-code files.

Small assets (below the inline threshold) are inlined as base64 data URIs.
Larger assets are copied with content-hashed filenames.

## Import patterns

    // Inlined as data URI (small file)
    import icon from './icon.svg'
    // icon = "data:image/svg+xml;base64,..."

    // Hashed URL (large file)
    import photo from './photo.jpg'
    // photo = "/assets/photo-a1b2c3d4.jpg"

# `asset?`

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

Check if a path is a known asset type.

# `copy_hashed`

```elixir
@spec copy_hashed(String.t(), String.t()) :: {:ok, String.t()}
```

Copy an asset to the output directory with a content-hashed filename.

Returns `{:ok, hashed_filename}`.

# `mime_type`

```elixir
@spec mime_type(String.t()) :: String.t()
```

Get MIME type for a file extension.

# `to_js_module`

```elixir
@spec to_js_module(
  String.t(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}
```

Generate a JS module that exports the asset URL or data URI.

## Options

  * `:inline_limit` — byte threshold for inlining (default: 4096)
  * `:prefix` — URL prefix for hashed assets (default: `"/assets"`)
  * `:outdir` — output directory for copied assets (production only)

---

*Consult [api-reference.md](api-reference.md) for complete listing*
