Hello there,
I’m trying to load image assets in heex html code.
I’ve tried the following:
<img src="<%= Routes.static_path(@conn, "/images/psi.png") %>"/>
Compile error: expected closing " for attribute value
<img src={ Routes.static_path(@conn, "/images/psi.png") } />
<img src={ Routes.static_path(@conn, "/psi.png") } />
It compiles but doesn’t render the image and trying to open the image in a new tab it complains:
no route found for GET /psi.png
<img src="/images/psi.png" />
Trying to load the image directly is just the same, no render, no route found.
My endpoint:
plug Plug.Static,
at: "/",
from: :health,
gzip: false,
only: ~w(assets fonts images favicon.ico robots.txt)
I would like to ask for help to understand why it doesn’t work and what is the correct way of using it?
<%= Routes %>, { Routes } or directly passing “/images/x”?






















