[SOLVED] How can I add my fonts to hanami app?


#1

I added “selawkl.ttf” font into

apps/web/assets/fonts

folder.
But, I recieved next error after page load:

HTTP/1.1 GET 404 127.0.0.1 /fonts/selawkl.ttf

How can I add “selawkl” font to Hanami app?


#2

I moved my fonts folder to “public” path and this fixed my problem.


#3

@milovidov It used to return a 404 because you used /fonts/selawkl.ttf instead of /assets/selawkl.ttf. What happens if you move back it to apps/web/assets/fonts and you’ll do the request with the URL that I suggested? Thank you.


#4

This is not usefull for me. I use bootstrap, and fonts are requeried by url /fonst/selawkl.ttf. But, is there a way for routing /fonts/selawkl.ttf to assets/selawkl.ttf?


#5

@milovidov Oh I see. I personally patch local versions of these UI frameworks to match Hanami expected URLs. But it’s fine to have the solution that you found. Thanks.


Fonts and images from an assets-only gem