Skip to content

Commit 279a851

Browse files
committed
Add static plug for collected images
1 parent 61c55f1 commit 279a851

File tree

1 file changed

+25
-14
lines changed
  • apps/components_guide_web/lib/components_guide_web

1 file changed

+25
-14
lines changed

apps/components_guide_web/lib/components_guide_web/endpoint.ex

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,55 @@ defmodule ComponentsGuideWeb.Endpoint do
77
signing_salt: "BfF2quM8"
88
]
99

10-
socket "/socket", ComponentsGuideWeb.UserSocket,
10+
socket("/socket", ComponentsGuideWeb.UserSocket,
1111
websocket: true,
1212
longpoll: false
13+
)
1314

14-
socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]
15+
socket("/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]])
1516

1617
# Serve at "/" the static files from "priv/static" directory.
1718
#
1819
# You should set gzip to true if you are running phx.digest
1920
# when deploying your static files in production.
20-
plug Plug.Static,
21+
plug(Plug.Static,
2122
at: "/",
2223
from: :components_guide_web,
2324
gzip: false,
2425
only: ~w(css fonts images js favicon.ico robots.txt collected)
26+
)
27+
28+
plug(Plug.Static,
29+
at: "/collected/image",
30+
from: {:components_guide_web, "priv/static/collected/image"},
31+
gzip: false,
32+
only: ~w(svg png jpg gif)
33+
)
2534

2635
# Code reloading can be explicitly enabled under the
2736
# :code_reloader configuration of your endpoint.
2837
if code_reloading? do
29-
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
30-
plug Phoenix.LiveReloader
31-
plug Phoenix.CodeReloader
38+
socket("/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket)
39+
plug(Phoenix.LiveReloader)
40+
plug(Phoenix.CodeReloader)
3241
end
3342

34-
plug Phoenix.LiveDashboard.RequestLogger,
43+
plug(Phoenix.LiveDashboard.RequestLogger,
3544
param_key: "request_logger",
3645
cookie_key: "request_logger"
46+
)
3747

38-
plug Plug.RequestId
39-
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
48+
plug(Plug.RequestId)
49+
plug(Plug.Telemetry, event_prefix: [:phoenix, :endpoint])
4050

41-
plug Plug.Parsers,
51+
plug(Plug.Parsers,
4252
parsers: [:urlencoded, :multipart, :json],
4353
pass: ["*/*"],
4454
json_decoder: Phoenix.json_library()
55+
)
4556

46-
plug Plug.MethodOverride
47-
plug Plug.Head
48-
plug Plug.Session, @session_options
49-
plug ComponentsGuideWeb.Router
57+
plug(Plug.MethodOverride)
58+
plug(Plug.Head)
59+
plug(Plug.Session, @session_options)
60+
plug(ComponentsGuideWeb.Router)
5061
end

0 commit comments

Comments
 (0)