diff --git a/lib/simpleshop_theme_web/endpoint.ex b/lib/simpleshop_theme_web/endpoint.ex index cff1ba9..fdd3484 100644 --- a/lib/simpleshop_theme_web/endpoint.ex +++ b/lib/simpleshop_theme_web/endpoint.ex @@ -16,18 +16,12 @@ defmodule SimpleshopThemeWeb.Endpoint do longpoll: [connect_info: [session: @session_options]] # Serve at "/" the static files from "priv/static" directory. - # - # When code reloading is disabled (e.g., in production), - # the `gzip` option is enabled to serve compressed - # static files generated by running `phx.digest`. - # - # Cache headers: 1 year for all static assets. Digested assets (with hash - # in filename) use `immutable`. Fonts/mockups/images rarely change and - # benefit from aggressive caching. + # gzip is always enabled — Plug.Static serves .gz files when they exist + # (created by `mix phx.digest`), falls back to uncompressed otherwise. plug Plug.Static, at: "/", from: :simpleshop_theme, - gzip: not code_reloading?, + gzip: true, only: SimpleshopThemeWeb.static_paths(), cache_control_for_etags: "public, max-age=31536000, immutable"