mix compile.ash_dispatch (AshDispatch v0.5.0)
View SourceMix compiler that copies AshDispatch templates to priv/ directory.
Disabled by default for fast development iteration. Templates are loaded
directly from lib/ in dev mode.
Required for production releases because lib/ source files are not
included in releases - only priv/ is bundled. Without this, template
rendering (emails, previews) won't work in production.
Configuration
# config/dev.exs - disabled (default)
# Templates load from lib/ for fast iteration
# config/prod.exs - REQUIRED for releases
config :ash_dispatch,
compile_templates: trueWhat It Does
When enabled, scans for templates in:
lib/{app}/{domain}/events/{event}/templates/*.{heex,eex}
And copies them to:
priv/ash_dispatch/templates/priv/ash_dispatch/manifest.json
This ensures templates are available at runtime in production releases.
Usage
Add to your mix.exs:
def project do
[
compilers: Mix.compilers() ++ [:ash_dispatch]
]
endThe compiler runs during mix compile but only copies files when
compile_templates: true is configured.