Installation

View Source

Get Mau up and running in your Elixir project.

Requirements

  • Elixir 1.14 or higher
  • Erlang/OTP 25.0 or higher

Installation Steps

1. Add Mau to Your Dependencies

Open your mix.exs file and add Mau to the deps function:

def deps do
  [
    {:mau, "~> 0.5"}
  ]
end

2. Fetch Dependencies

Run the following command in your project directory:

mix deps.get

This will download Mau and its dependencies.

3. Verify Installation

Create a simple test in your IEx console:

iex -S mix

Then run:

iex> template = "Hello {{ name }}!"
iex> context = %{"name" => "World"}
iex> Mau.render(template, context)
{:ok, "Hello World!"}

If you see {:ok, "Hello World!"}, Mau is properly installed!

Optional Configuration

Enable Runtime Custom Filters

If you want to use custom filters at runtime, add configuration to config/config.exs:

config :mau,
  enable_runtime_filters: true,
  filters: [MyApp.CustomFilters]

Then add Mau.FilterRegistry to your supervision tree in lib/my_app/application.ex:

def start(_type, _args) do
  children = [
    # ... other supervisors
    Mau.FilterRegistry
  ]

  opts = [strategy: :one_for_one, name: MyApp.Supervisor]
  Supervisor.start_link(children, opts)
end

Troubleshooting

Compilation Issues

If you encounter compilation errors, try:

# Clean build artifacts
mix clean

# Recompile
mix compile

Version Conflicts

If you have dependency version conflicts, update your mix.lock:

mix deps.unlock mau
mix deps.get

Next Steps

Getting Help