Today I Learned

A Hashrocket project

Add Elixir files to your compiled list

While working on an Elixir package today, I wanted to add the test/support directory to my compiled files. I knew the Phoenix Framework did this so I went there to take a look and discovered elixirc_paths.

The Phoenix frameworks example looks like this:

  # mix.exs
  def project do
    [
      ...
      elixirc_paths: elixirc_paths(Mix.env),
      ...
    ]
  end
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_),     do: ["lib"]

Perfect! Now we can add additional directories to our compiled path that are environment specific.

Looking for help? Elixir is quickly gaining momentum for web applications that need concurrency, performance, and the ability to connect to many different clients. The developers at Hashrocket are learning along with the rest of the development community that Elixir and Phoenix are viable Rails alternatives for the right application. Check out the source code for Today I Learned, written in Elixir, and contact us if you need help with your Elixir project.