Volt.Pipeline (Volt v0.4.3)

Copy Markdown View Source

Compile source files to browser-ready JavaScript and CSS.

Dispatches to OXC for JS/TS/JSX/TSX and Vize for Vue SFCs and CSS. Returns compiled output with optional sourcemaps.

Summary

Functions

Compile a source file to browser-ready output.

Types

compiled()

@type compiled() :: %{
  code: String.t(),
  sourcemap: String.t() | nil,
  css: String.t() | nil,
  hashes:
    %{
      template: String.t() | nil,
      style: String.t() | nil,
      script: String.t() | nil
    }
    | nil
}

Functions

compile(path, source, opts \\ [])

@spec compile(String.t(), String.t(), keyword()) ::
  {:ok, compiled()} | {:error, term()}

Compile a source file to browser-ready output.

Options

  • :target — downlevel target (e.g. :es2020)
  • :import_source — JSX import source (e.g. "vue")
  • :sourcemap — generate source maps (default: true)
  • :minify — minify output (default: false)
  • :vapor — use Vue Vapor mode (default: false)
  • :rewrite_import — function (specifier -> {:rewrite, new} | :keep) for import rewriting

  • :plugins — list of Volt.Plugin modules to run