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.

- 50,409
- 12
- 130
- 115
-
@Korbin Setting a symlink of aurelia root directory to priv/static - will that help? – Raj Aug 23 '15 at 02:32
-
I think I'm going to follow Jose's advice and not change it. I'm just pointing the jspm packages to a directory inside of the priv/static folder. – Korbin Sep 28 '15 at 21:44
-
For those like me who wanted to *add* another repository to the static ones, what worked for me is to use the `CopyWebpackPlugin` in my webpack config to make sure it goes to `priv/static` in the end: `new CopyWebpackPlugin([{ from: 'path_to_repository', to: '..' }])` – Augustin Riedinger May 14 '20 at 12:01