Volt (Volt v0.14.0)

Copy Markdown View Source

Elixir-native frontend build tool.

Provides a dev server with hot module replacement (HMR) and production builds for JavaScript, TypeScript, Vue SFCs, and CSS — powered by OXC and Vize Rust NIFs. No Node.js required at runtime.

Setup

Add Volt to your Phoenix endpoint as a Plug:

plug Volt.DevServer,
  root: "assets/src",
  target: :es2020

Or use the Mix tasks:

mix volt.build       # Production build

Summary

Functions

Returns the browser path for the configured Volt entry.

Returns the browser path for a Volt-managed static asset.

Returns the browser URL for a Volt-managed static asset.

Functions

entry_path(endpoint, overrides \\ [])

This function is deprecated. use Volt.static_path/2 with the compiled asset path instead.

Returns the browser path for the configured Volt entry.

In development this points at the source module served by Volt.DevServer. In production it reads manifest.json and returns the built asset path.

static_path(conn_or_socket_or_endpoint_or_uri, path, overrides \\ [])

Returns the browser path for a Volt-managed static asset.

In development, JavaScript entry paths point at the source module served by Volt.DevServer. In production, Volt reads manifest.json and returns the built asset path, passing the result through Phoenix static_path/1 when an endpoint is available.

static_url(conn_or_socket_or_endpoint, path, overrides \\ [])

Returns the browser URL for a Volt-managed static asset.