View Source Phoenix.CodeReloader (Phoenix v1.7.0-rc.0)
A plug and module to handle automatic code reloading.
To avoid race conditions, all code reloads are funneled through a sequential call operation.
Link to this section Summary
Functions
API used by Plug to invoke the code reloader on every request.
API used by Plug to start the code reloader.
Reloads code for the current Mix project by invoking the
:reloadable_compilers
on the list of :reloadable_apps
.
Same as reload/1
but it will raise if Mix is not available.
Synchronizes with the code server if it is alive.
Link to this section Functions
API used by Plug to invoke the code reloader on every request.
API used by Plug to start the code reloader.
Reloads code for the current Mix project by invoking the
:reloadable_compilers
on the list of :reloadable_apps
.
This is configured in your application environment like:
config :your_app, YourAppWeb.Endpoint,
reloadable_compilers: [:gettext, :elixir],
reloadable_apps: [:ui, :backend]
Keep in mind :reloadable_compilers
must be a subset of the
:compilers
specified in project/0
in your mix.exs
.
The :reloadable_apps
defaults to nil
. In such case
default behaviour is to reload the current project if it
consists of a single app, or all applications within an umbrella
project. You can set :reloadable_apps
to a subset of default
applications to reload only some of them, an empty list - to
effectively disable the code reloader, or include external
applications from library dependencies.
This function is a no-op and returns :ok
if Mix is not available.
Same as reload/1
but it will raise if Mix is not available.
@spec sync() :: :ok
Synchronizes with the code server if it is alive.
It returns :ok
. If it is not running, it also returns :ok
.