I am unable to load fonts from /public folders in postcss. #90
-
Hi! I am trying to use vite_rails_legacy on one of my existing rails 4 project. I have successfully modified every files and plugins to work with vite and now everything works except the fonts. I have fonts.pcss and icons.pcss which declares the font family. the font files are located inside public directory. When I run vite dev server, all the fonts request shows 404 and all icons are blank. But, if I make any changes in fonts.pcss or icons.pcss while server is running, the fonts get loaded and everything works fine. I also tried moving the fonts to frontend folder, but it didn't work either. I don't know, what I'm doing wrong here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi Prios, would you share the relevant content in your Unless you need the font file names to stay unchanged, I'd recommend letting Vite fingerprint them so that they can be cached by the browser forever. For example, try placing the relevant font files in |
Beta Was this translation helpful? Give feedback.
Hi Prios, would you share the relevant content in your
font.pcss
andicons.pcss
file? Please share screenshots of the errors that you are seeing in the browser/Vite/Rails.Unless you need the font file names to stay unchanged, I'd recommend letting Vite fingerprint them so that they can be cached by the browser forever.
For example, try placing the relevant font files in
app/frontend/fonts
, and reference them as~/fonts/
in your.pcss
file.