The default install of Phoenix has live reload working when I make changes to the original index.html.heex file on a new Phoenix project, however, if I happen to make the following changes below to the “router” and “page_controller” to modify the home page such that when I change the string “some text” in the “page_controller”, live reload is not working.
I do see that in my console that the “Rebuilding…” message does appear, but there is no live reload in the browser.
router.ex
# ...
scope "/", AppsWeb do
pipe_through :browser
get "/", PageController, :test
end
# ...
page_controller.ex
# ...
def test(conn, _params) do
html(conn, "some text")
end
# ...
I tried adding in controllers files into the dev.exs live_reload configuration, but was unable to get the changes to pick up in live reload
#...
live_reload: [
iframe_attrs: [class: "hidden"],
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/phoenix_with_tailwindcss_web/(controllers|live|views)/.*(ex)$",
~r"lib/phoenix_with_tailwindcss_web/templates/.*(eex)$"
]
]
#...
My mix.exs dependencies
defp deps do
[
{:phoenix, "~> 1.6.2"},
{:phoenix_ecto, "~> 4.4"},
{:ecto_sql, "~> 3.6"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.16.0"},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.5"},
{:swoosh, "~> 1.3"},
{:telemetry_metrics, "~> 0.6"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.18"},
{:jason, "~> 1.2"},
{:plug_cowboy, "~> 2.5"}
]
end
Using
Erlang/OTP 24 [erts-12.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.12.3 (compiled with Erlang/OTP 24)