Volt.Tailwind (Volt v0.8.4)

Copy Markdown View Source

Tailwind CSS integration — scan source files for candidates and compile CSS.

Uses Oxide for fast parallel content scanning and QuickBEAM to run the Tailwind CSS compiler. No Node.js or CLI required.

Usage

# In your config:
config :volt, :tailwind,
  sources: [
    %{base: "lib/", pattern: "**/*.{ex,heex}"},
    %{base: "assets/", pattern: "**/*.{vue,ts,tsx}"}
  ]

# Generate CSS:
{:ok, css} = Volt.Tailwind.build()

Tailwind directives

Volt supports Tailwind's CSS-first directives like @theme, @source, @utility, @variant, and @apply through the Tailwind compiler.

Volt also resolves local @import, @reference, @plugin, and @config files inside QuickBEAM, plus installed package plugins like @tailwindcss/typography.

Summary

Functions

Compile Tailwind CSS from scanned candidates.

Returns a specification to start this module under a supervisor.

Incremental build — only process changed files and return CSS if new candidates found.

Functions

build(opts \\ [])

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

Compile Tailwind CSS from scanned candidates.

Scans all configured source directories for Tailwind class candidates, then runs the Tailwind compiler to generate CSS.

Options

  • :css — custom input CSS (default: Tailwind's base with theme + preflight + utilities)
  • :css_base — base directory for resolving local @import, @reference, @plugin, and @config paths
  • :sources — override source patterns (default: from config)
  • :minify — minify the output CSS (default: false)

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

rebuild(changed_files, opts \\ [])

@spec rebuild(
  list(),
  keyword()
) :: {:ok, String.t()} | :unchanged | {:error, term()}

Incremental build — only process changed files and return CSS if new candidates found.

Returns {:ok, css} if new candidates were found, :unchanged otherwise.

start_link(opts \\ [])