I’m using Plug.Static and not using npm.
My Endpoint:
defmodule MyAppWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :my_app
socket "/socket", MyAppWeb.UserSocket
plug MyAppWeb.MyFileUpload
And my plug:
# my_file_upload.ex
defmodule MyAppWeb.FileUploadServant do
use Plug.Builder
plug Plug.Static, at: "/uploads", from: "/opt/my_app/uploads"
plug Plug.Static, at: "", from: "priv/assets/static", gzip: false
def not_found(conn, _) do
send_resp(conn, 404, "not found")
end
end
After deploying on a server and manually copying static assets to “/home/my_user/my_app/builds/priv/assets/static”, it still can’t find them.
<html>
<!-- ....... -->
<link href="/css/my_css_file.css" ...... <--- won't be found
Whereas all “uploads” are found and displayed properly.
What’s up with that?