One of implementation could be - adding plug dependency to the mix file of the project. then configure it
And after making configure to make it work with plug.
Then you add that package as the mix dependency and then you configure your phoenix app to use that plug in the phoenix endpoint.
There is an example below of how phoenix use static plug - (location: lib/endpoint.ex)
at: “/”, from: :stock, gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt)
We could do similar way to solve your problem.
The implementation might be little difficult, but I think that this should answer your question.
After looking into your Problem again last night. I want to update my answer little more. I don’t think we need plug as dependency in another app also.
Since I think we could do something like this -. Let’s consider your another app (The app that you want to put to the hex and then add this app as your dependency to the Phoenix app) has your static files under
priv/static path. You could create a plug like below that will get static assets from your hex package.
at “/fromhex/”, from: :youhexpackagename, gzip: false
Please try. I think this should work
Anyway, thanks a lot.
You are welcome @grych
Got any links for documentation pertaining to creating a hex package - I’d like to create a task which I’d release open-source.