Jakub Zawiślak
Jakub Zawiślak

Reputation: 5502

Phoenix - recompile local dependency on file change without server restart

I'm developing a library for Phoenix. I have created a Phoenix project with mix.exs:

defp deps do
  [{:phoenix, "~> 1.2.1"},
  ...
  {:my_package, path: "../my_package"}]
end

and I want Phoenix to automatically recompile that dependency when I change it, without restarting a Phoenix server. Is it possible? I have already tried installing remix to both Phoenix and my_package and adding ~r{../my_package/lib/.*(ex)$} in live_reload Phoenix config, but nothing works.

Upvotes: 0

Views: 1001

Answers (1)

Jakub Zawiślak
Jakub Zawiślak

Reputation: 5502

As Justin Wood said - umbrella project is the answer. I put my_package and my phoenix app inside umbrella project, now phoenix refreshes (and compiles) page each time I change something in my_package. More:

https://gist.github.com/emilsoman/9bdabbfe873ef28358d83eaa11d45024

http://elixir-lang.org/getting-started/mix-otp/dependencies-and-umbrella-apps.html

Upvotes: 1

Related Questions