Phoenix v1.4.9 Phoenix.CodeReloader View Source

A plug and module to handle automatic code reloading.

For each request, Phoenix checks if any of the modules previously compiled requires recompilation via __phoenix_recompile__?/0 and then calls mix compile for sources exclusive to the web directory.

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.

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.

Link to this function

reload!(endpoint) View Source
reload!(module()) :: :ok | {:error, binary()}

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, YourApp.Endpoint,
  reloadable_compilers: [:gettext, :phoenix, :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 current project if it consists of single app, or all applications within umbrella project. You can set :reloadable_apps to subset of default applications to reload only some of them, empty list - to effectively disable code reloader, or include external applications from library dependencies.