Not working…how? The log file should give a whole ton of information when reloading fails or it reloads or so? Do you have a minimal reproduceable project?
if code_reloading? do
plug Phoenix.CodeReloader
end
instead of
if code_reloading? do
socket("/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket)
plug(Phoenix.LiveReloader)
plug(Phoenix.CodeReloader)
end
Try generating a new phoenix project with mix phx.new my_app, verify that live reload works there, and diff against nilcrud to see what exactly you are missing.
--no-brunch will generate a project without code reloading, as there is nothing to compile the files you want to reload and as you saw there are no watchers being set when you generate a project with that flag.
Is there some recommended way to implement it myself with --no-brunch project, or would it be better to use project with Brunch even though I don’t need it?
Even for a --no-brunch project @idi527’s post covers all the salients points (another example).
“Hook in” your watch/build script into config/dev.exs then whenever that script builds the assets, Phoenix LiveReloader will reload the page. And pay particular attention to the patterns under live_reload - if the built files aren’t covered by those patterns phoenix won’t reload.
That’s probably because you also used the --no-html option which indicates that Phoenix doesn’t serve any assets at all.
In this context “live reloading” refers to Phoenix reloading the page whenever it detects that CSS, JS, EEx template, or Elixir view code has been updated.
Are you possibly talking about automatic recompilation when you modify some non-web Elixir sources?