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"
Summary
Functions
Check if a path is a known asset type.
Copy an asset to the output directory with a content-hashed filename.
Get MIME type for a file extension.
Generate a JS module that exports the asset URL or data URI.
Functions
Check if a path is a known asset type.
Copy an asset to the output directory with a content-hashed filename.
Returns {:ok, hashed_filename}.
Get MIME type for a file extension.
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)