Need help accessing priv/static/vendor folder in my template

Hello,

I am new to Elixir/Phoenix and have been developing a website to learn. So far I am really enjoying the experience and thank you for the community.

I am running into a small issue and hope I can get some help or pointers. I am using some vendor assets ( css and js) which I have placed in a vendor folder. The file structure looks as follows

priv/static/vendor/headroomjs/
priv/static/vendor/onscreen/ etc

My endpoint looks like this.

  live_reload: [
    patterns: [
      ~r"priv/static/*/.*(js|css|png|jpeg|jpg|gif|svg)$",
      ~r"priv/gettext/.*(po)$",
      ~r"lib/dating_upd_web/(live|views)/.*(ex)$",
      ~r"lib/dating_upd_web/templates/.*(eex)$"
    ]

When I am accessing a javascript file in my template as

<script type="text/javascript" src="<%= Routes.static_path(@conn, "/vendor/headroomjs/headroom.min.js") %>"></script>

it is throwing an error…

* (Phoenix.Router.NoRouteError) no route found for GET /vendor/headroomjs/headroom.min.js

What am I doing wrong?. Is it not possible to access vendor folders directly from Routes.static_path? If I cannot access directly, how can i access these files?

Thank you for your help.
Phunsukh.

Look at plug static in your endpoint. There is a filter for top level files/folders, which does not include vendor.