mix ash_dispatch.gen.previews (AshDispatch v0.7.2)

View Source

Generates static HTML/text preview files for all AshDispatch events.

This task renders each event template with its sample_data/0 and outputs static files for easy preview, documentation, or CI validation.

Usage

mix ash_dispatch.gen.previews              # Generate all previews
mix ash_dispatch.gen.previews --output priv/previews  # Custom output dir
mix ash_dispatch.gen.previews --check      # CI mode - fail if outdated
mix ash_dispatch.gen.previews --verbose    # Show detailed output

Output Structure

Previews are generated to priv/ash_dispatch/previews/ by default:

priv/ash_dispatch/previews/
├── index.html                           # Index with links to all previews
├── user.password_reset/
│   ├── email.user.html                  # Rendered HTML email for user audience
│   ├── email.user.txt                   # Rendered text email for user audience
│   └── metadata.json                    # Event metadata (subject, from, etc.)
├── user.email_confirmation/
│   ├── email.user.html
│   ├── email.user.txt
│   └── metadata.json
└── orders.created/
    ├── email.user.html                  # User audience template
    ├── email.admin.html                 # Admin audience template
    ├── email.admin.summary.html         # Admin with 'summary' variant
    ├── email.user.txt
    ├── email.admin.txt
    ├── email.admin.summary.txt
    └── metadata.json

Integration with Ash Codegen

This task can be run alongside other generators:

mix ash.codegen                          # Runs all extension codegens
mix ash_dispatch.gen.previews            # Run after to generate previews

Use Cases

  • Design review: Share rendered emails with designers
  • Documentation: Include in project docs
  • CI validation: Ensure templates render without errors
  • Quick testing: View all emails without running the app