Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live reload not triggering #134

Open
mfeckie opened this issue Feb 22, 2023 · 2 comments
Open

Live reload not triggering #134

mfeckie opened this issue Feb 22, 2023 · 2 comments

Comments

@mfeckie
Copy link

mfeckie commented Feb 22, 2023

Version: {:phoenix_live_reload, "~> 1.2", only: :dev}

I have components in this folder lib/cockpit_web/components

with the following config for live_reload

  live_reload: [
    patterns: [
      ~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"lib/cockpit_web/(components|live|views)/.*(ex)$",
      ~r"lib/cockpit_web/templates/.*(eex)$"
    ]
  ]

Saving files in the components folder, such as lib/cockpit_web/components/common.ex does not trigger a rebuild

Saving files in the live folder does. lib/cockpit_web/live/deployments_live.ex

I can't seem to figure out why this is the case and would love some insights into what I'm doing wrong

@ellismarkf
Copy link

ellismarkf commented Mar 16, 2023

Is it that the browser doesn't reload, or that saving doesn't trigger a rebuild?

I ran into an issue where saving would trigger a rebuild, but the browser wouldn't refresh until I manually reloaded the page, even for CSS changes in template files. If that's the issue you're seeing, make sure that your root.html.heex has a body html tag in it. I had moved the body tag to a different layout file, and that's when the browser refresh stopped working.

Based on this line it seems like the plug expects an HTML document with a body tag for it to work. @chrismccord is that true? Wonder if that's something that could be optionally configured?

Might be worth mentioning at least in the README, so noobs like me don't make that mistake 😂 Happy to open a PR if you think it's worth the effort!

@wodow
Copy link

wodow commented Nov 1, 2023

it seems like the plug expects an HTML document with a body tag for it to work

Excellent find, @ellismarkf . Thank you -- saved me some serious debugging.

I will add a specific issue to warn on this, since this one is broader.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants