使elixir应用程序重新编译并在源代码更改时重新加载 [英] Make elixir app recompile and reload on source code change
问题描述
如何在每次修改源代码时自动重新编译并重新加载我的iex + mix应用程序?
How to automatically recompile and reload my iex + mix application every time I modify the source code?
如果iex + mix组合无法做到这一点,最简单的选择是什么?我已经检查了phoenix的重新加载方式,对于我的小型测试项目来说似乎并不容易实现。
If there's no way for iex + mix combination to do that, what's the easiest alternative? I've checked phoenix's way to do reload, and it doesn't seems easy to implement for my small test project.
我也知道José的 .iex.exs
:
defmodule R do
def reload! do
Mix.Task.reenable "compile.elixir"
Application.stop(Mix.Project.config[:app])
Mix.Task.run "compile.elixir"
Application.start(Mix.Project.config[:app], :permanent)
end
end
我不是很高兴,因为它不会在代码更改时自动重新加载,我仍然需要在iex上键入 R.reload!
。
And I'm not extremely happy since it's not reloading automatically on code change, I still need to type R.reload!
on iex.
然后..请帮助我在stackoverflow上创建 iex标签,我的声誉还不够:)
And.. please help me create "iex" tag on stackoverflow, my reputation is not sufficient :)
推荐答案
当前 iex
具有执行此操作的内部功能:
Currently iex
has an internal function to do this:
调用 IEx.Helpers.recompile c $ c> iex 控制台。
invoke IEx.Helpers.recompile inside iex
console.
这篇关于使elixir应用程序重新编译并在源代码更改时重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!