Skip to content

Commit

Permalink
Set gzip default based on code reloading in endpoint (#5972)
Browse files Browse the repository at this point in the history
Adjust the default for the gzip flag in the generated endpoint to take
code reloading into account.

Fixes #5960
  • Loading branch information
rmoorman authored Nov 26, 2024
1 parent a3ca54d commit 086b837
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions installer/templates/phx_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ defmodule <%= @endpoint_module %> do

# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phx.digest
# when deploying your static files in production.
# When code reloading is disabled (e.g., in production),
# the `gzip` option is enabled to serve compressed
# static files generated by running `phx.digest`.
plug Plug.Static,
at: "/",
from: :<%= @web_app_name %>,
gzip: false,
gzip: not code_reloading?,
only: <%= @web_namespace %>.static_paths()

# Code reloading can be explicitly enabled under the
Expand Down

0 comments on commit 086b837

Please sign in to comment.