# Keeping stale gzip assets out of Phoenix tests

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:

```elixir
# lib/elixir_drops_web/endpoint.ex
plug Plug.Static,
  at: "/",
  from: :elixir_drops,
  gzip: Application.compile_env(:elixir_drops, :serve_gzip_assets, true)
```

```elixir
# 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.

Source: https://hexdocs.pm/plug/Plug.Static.html


---

Created by: almirsarajcic
Date: September 13, 2026
URL: https://elixirdrops.net/d/j1f6rgYb
