Static path in custom folder?

I created a new project with --no-bunch. I wan’t to put some javascript files in their own custom folder and not in the customary “js” folder. So under priv/static I created a new folder “custom” alongside the “js” folder. I put a file inside it alert.js. So now I have


and in the layout template I put this line

<script src="<%= static_path(@conn, "/custom/alert.js") %>"></script>

When I do this I get 404 for the file “alert.js”

When I move the file in the “js” folder



<script src="<%= static_path(@conn, "/js/alert.js") %>"></script>

it works fine. How to make static_path to also include the “custom” folder? I searched for static_path in source code but I admit I didn’t understand a lot.

You need to include the custom in your MyApp.Endpoint module. That file is located at lib/my_app/endpoint.ex

defmodule MyApp.Endpoint
  use Phoenix.Endpoint, otp_app: :my_app

  # ...

  plug Plug.Static,
    at: "/", from: :my_app, gzip: false,
    only: ~w(css custom fonts images js favicon.ico robots.txt)

  # ...


Thanks. I saw that file before but it didn’t occur to me that these were actually files and folders to be filtered.