Fonts not included

I hit a small snag trying to build my Phoenix app with Webpack, namely fonts are not included by the app.

  1. I have clean Webpack build - copies whole bunch of fonts, one JS file with embedded CSS. After the build all the font files are are placed in /web/priv/static/fonts/ directory and my JS file ends up in /web/priv/static/js/

  2. During the build only the fonts which my CSS file is actually referencing are copied/extracted (which is what I’d expect),

  3. So far all the styles from my CSS file work as expected, however I’m getting errors when trying to use styles which reference these fonts. I looked in Chrome and I don’t see fonts directory in the tree

  4. Fonts are present in /web/priv/static/fonts - they should be served and they are not. Of course my endpoint is configured to serve fonts.

1 Like

I believe priv/static might be the directory you’re looking for, not web/priv/static. :slight_smile:

2 Likes

Hell yes! That worked, thank you:)

Also for anyone else reading this, when you add a new directory in priv/static that you want exposed to the web, be sure to add it to the Plug.Static config in your endpoint.ex file. :slight_smile: