Elixir Language Mix Aliases

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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.



Got any Elixir Language Question?