only enable gzip static file serving in prod
All checks were successful
deploy / deploy (push) Successful in 52s

Avoids stale .gz files from mix assets.deploy shadowing freshly-built
dev assets. This was causing the admin to render with old DaisyUI dark
theme CSS even after the unified theme migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey 2026-02-21 08:56:51 +00:00
parent 7e6fb5ab04
commit 8e818da651

View File

@ -16,14 +16,12 @@ defmodule BerrypodWeb.Endpoint do
longpoll: [connect_info: [session: @session_options]]
# Serve at "/" the static files from "priv/static" directory.
# gzip is always enabled — Plug.Static serves .gz files when they exist
# (created by `mix phx.digest`), falls back to uncompressed otherwise.
# In prod, digested filenames change per deploy so immutable caching is safe.
# In dev, we omit the option to get the Plug.Static default ("public").
# gzip only in prod — avoids stale .gz files from mix assets.deploy
# shadowing freshly-built dev assets.
plug Plug.Static,
at: "/",
from: :berrypod,
gzip: true,
gzip: Application.compile_env(:berrypod, :env) == :prod,
only: BerrypodWeb.static_paths(),
cache_control_for_etags:
if(Application.compile_env(:berrypod, :env) == :prod,