How to reference the correct static file in phoenix

I have asked this question on stack overflow, but am thinking that this is probably a better place for it.

The question has been asked here:

In a phoenix project, I can reference digested img in a css file with:

background-image: url("/images/phoenix.png");

and that references:


I would like to reference the same file, but the image src added with javascript, like so:

document.querySelector('#my-img').src = '/images/phoenix.png';

But this only references:


How can I configure the phoenix endpoint to instead serve the digested img file?

(I would like this functionality for updating cached file purposes)