adityakunhare liked a comment+100 XP
2mos ago
Just found an even better solution than the one I suggested earlier, and that seems to me even easier than sysoutlucas's, thanks to the Laravel doc (vite#blade-processing-static-assets). You can leave your assets in resources and then put:
import.meta.glob([
'../fonts/**',
]);
in your app.js file. Leave url('../fonts/your-font.ttf') (or /resources/fonts/your-font.ttf I think it would also work) in your css. After running npm run build, I can see in my browser that Vite has changed the url to /build/assets/my-font.ttf (if I'm just running npm run dev, it shows /resources/fonts/my-font.ttf).
Hope this helps!