:code.priv_dir at compile time and releases

say I have a module attribute like

@priv :code.priv_dir(:my_app)

or sth else that gets compiled, like

~H"""<%= :code.priv_dir(:my_app) %>"""

This all works fine but if you mix release the priv-dir changes and the path becomes invalid.
What do? Where to put my files?

What I actually do is load some css from priv like

<%= Phoenix.HTML.raw(:code.priv_dir(:my_app) ++ '/css/style.css') %>

Don’t do it at compile-time, do it inside a function. :slight_smile:

FWIW <%= inside ~H is not done at compile-time.

1 Like

indeed, I was just being stupid. So the problem is solved :crazy_face:

1 Like