Phoenix.LiveReloader

Router for live-reload detection in development.

Usage

Add the Phoenix.LiveReloader plug within a code_reloading? block in your Endpoint, ie:

if code_reloading? do
  socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
  plug Phoenix.CodeReloader
  plug Phoenix.LiveReloader
end

Configuration

For live-reloading in development, add the following :live_reload configuration to your Endpoint with a list of patterns to watch for changes:

config :my_app, MyApp.Endpoint, ... live_reload: [ patterns: [ ~r{priv/static/.(js|css|png|jpeg|jpg|gif)$}, ~r{web/views/.*(ex)$}, ~r{web/templates/.(eex)$} ] ]

By default the URL of the live-reload connection will use the browser's host and port. To override this, you can pass the :url option, ie:

config :my_app, MyApp.Endpoint, ... live_reload: [ url: "ws://localhost:4000", patterns: [ ~r{priv/static/.(js|css|png|jpeg|jpg|gif)$}, ~r{web/views/.*(ex)$}, ~r{web/templates/.(eex)$} ] ]

Source

Summary

call(conn, )

Callback implementation for c:Plug.call/2

init(opts)

Callback implementation for c:Plug.init/1

Functions

call(conn, )

Callback implementation for c:Plug.call/2.

Source
init(opts)

Callback implementation for c:Plug.init/1.

Source