0

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.

Jakub Zawiślak
  • 5,122
  • 2
  • 16
  • 21
  • 1
    Is it possible to put both projects inside of an umbrella project? – Justin Wood Jan 14 '17 at 15:22
  • 1
    _Sidenote:_ to me it smells like an SRP violation. I think, `my_package` should be produced and tested separately, otherwise you sooner or later end up with unresolved cross-dependencies;, preventing of using the package inside other apps. – Aleksei Matiushkin Jan 14 '17 at 18:17

1 Answers1

1

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

Jakub Zawiślak
  • 5,122
  • 2
  • 16
  • 21