How to serve static assets from user folders in phoenix

I want to use ckeditor in my phoenix project.

If I put the ckeditor files in / web / static / assets / ckeditor, the ckeditor folder is copied to / priv / static, but if I access the file in http: // localhost: 4000 / ckeditor / ckeditor.js , it shows me

route not found for GET / ckeditor / ckeditor.js

However, if I moved the entire ckeditor folder under the default name folder (js, css, image), then it will be served.

The static asset documentation http://www.phoenixframework.org/docs/static-assets assumes that everything that is placed there will be copied and maintained. But it seems that only the js / css / image / font folders are obtained, and not any custom folder with the name.

How can I serve these files?

+7
phoenix-framework
source share
1 answer

Take a look at the Plug.Static configuration in lib/YOUR_APP/endpoint.ex

Here's the default:

 plug Plug.Static, at: "/" only: ~w(css fonts images js sitemaps favicon.ico robots.txt) 

You can add additional folders to the only list, and they will also be served.

+16
source share

All Articles