Elixir Language Mix Aliases


Example

Elixir allows you to add aliases for your mix commands. Cool thing if you want to save yourself some typing.

Open mix.exs in your Elixir project.

First, add aliases/0 function to the keyword list that the project function returns. Adding () at the end of the aliases function will prevent compiler from throwing a warning.

  def project do
    [app: :my_app,
     ...
     aliases: aliases()]
  end

Then, define your aliases/0 function (e.g. at the bottom of your mix.exs file).

  ...

  defp aliases do
    [go: "phoenix.server",
     trident: "do deps.get, compile, go"]
  end

You can now use $ mix go to run your Phoenix server (if you're running a Phoenix application). And use $ mix trident to tell mix to fetch all dependencies, compile, and run the server.