We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Keeping stale gzip assets out of Phoenix tests
almirsarajcic
I spent too long debugging a LiveView hook in ElixirDrops because the browser kept running old JavaScript. The source and freshly built app.js were correct.
Here’s what we changed:
# lib/elixir_drops_web/endpoint.ex
plug Plug.Static,
at: "/",
from: :elixir_drops,
gzip: Application.compile_env(:elixir_drops, :serve_gzip_assets, true)
# config/test.exs
config :elixir_drops, :serve_gzip_assets, false
We had run mix phx.digest earlier, which left app.js.gz beside the plain asset. Our test build replaced app.js but not its compressed sibling, so Plug.Static correctly served the older gzip file.
This wasn’t a Phoenix bug. We mixed production digest output with an unversioned test build, then blamed the hook. Keep gzip enabled in production, where phx.digest generates versioned files and their compressed copies together.
copied to clipboard