Using Elixir Phoenix and esbuild, I installed fontawesome using NPM in the assets folder. I can properly load the SCSS files, but the fonts do not load. I get the following error:
no route found for GET /node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.ttf
You can @import other CSS files and reference image and font files with url() and esbuild will bundle everything together. Note that you will have to configure a loader for image and font files, since esbuild doesn’t have any pre-configured. Usually this is either the data URL loader or the external file loader.
It would probably help but I don’t find it an elegant solution. It’s more of a hack. I’d like to be in control of all the code I’m writing, especially when it’s deployed into prod
Btw I found another solution, also a workaround but IMO less messy. I simply symlinked the fonts into priv/static/fonts and set $fa-font-path: "/fonts"; It worked