mix compile.live_style (LiveStyle v0.15.0)

View Source

Mix compiler that merges LiveStyle module data after Elixir compilation.

This compiler runs after the standard Elixir compiler and merges all per-module data files into the manifest. It does NOT generate CSS - that's handled by the watcher (in development) or mix live_style command (in production builds), matching the esbuild/tailwind pattern.

Installation

Add to your mix.exs:

def project do
  [
    compilers: Mix.compilers() ++ [:live_style],
    # ...
  ]
end

Configuration

Configure the profile in your config/config.exs:

config :live_style,
  default: [
    output: "priv/static/assets/css/live.css",
    cd: Path.expand("..", __DIR__)
  ]

Development Setup

Add the watcher to your endpoint in config/dev.exs (like esbuild/tailwind):

watchers: [
  live_style: {LiveStyle, :install_and_run, [:default, ~w(--watch)]}
]

Production Build

In your deployment scripts, run:

mix live_style default

What This Compiler Does

Merges per-module data files into the manifest. CSS generation is handled separately by the watcher or mix live_style command.

  • mix live_style <profile> - Generate CSS (use in production builds)
  • mix live_style <profile> --watch - Watch mode for development