Why `Phoenix.Endpoint.static_url/1` doesn't exist?

I can write:

Routes.root_path(Vae.Endpoint, :index) # output: "/"
Routes.root_url(Vae.Endpoint, :index) # output: "https://example.com/"

The latter is especially useful for emails.

I can also write:

Vae.Endpoint.static_path("/images/my_asset.jpg") # outputs: "/images/my_asset.jpg" or the hashed version in prod
Vae.Endpoint.static_url() # outputs "https://example.com/"

But there ain’t

Vae.Endpoint.static_url("/images/my_asset.jpg") # expected output "https://example.com/images/my_asset.jpg"

So I have to write:

"#{Vae.Endpoint.static_url()}#{Vae.Endpoint.static_path("/images/my_asset.jpg")}"

Why is that?

1 Like