I'm currently using aurelia as my front end framework for my phoenix app. I would like to designate the jspm_packages folder in the root of my project as a static directory in addition to the priv/static folder. Is there a way to configure plug to do this?
1 Answers
The short answer is: you should not.
The long answer is: in production, Elixir applications care about two directories: 1. ebin (which is where you put compiled code) and 2. priv (auxiliary files that you need to run your software in production, like static files). If you rely on a file that is not in any of those directories, things can break when running in production or building releases. So I would advise you to move the aurelia stuff inside priv/static or have a tool that compiles aurelia artifacts to priv/static at the end of the day.
If you don't want to do that, the "I have warned you" alternative is here: http://hexdocs.pm/plug/Plug.Static.html. You can set from: "."
when configuring Plug.Static
in your Phoenix endpoint at lib/my_app/endpoint.ex
. You can also plug more than one Plug.Static
if you want.