Does anybody know how this works in something like webpack? Because nobody else on the internet seems to be having a problem with @fontsource. Does it parse the css, bundle the referenced font files somewhere and then change the path for the referenced files?
No, but thank you. I did read that post before I added mine.
Yes, we can manually copy the fonts, or manually copy the fonts and referencing css, or script all that copying ourselves, but the point of the npm module is to make that unnecessary. So I’m trying to understand why other build systems can just consume fontsource and Meteor’s can’t. (Partly so I feel like I know the “right way” of solving this problem, and can understand what’s going on when I encounter this problem in the future.)
OK. I think I gave up on that approach after some research. I could not make it work. If you can make it work, I would be very interested in the solution.
So the best solution for Meteor going forward is probably to modify addStyles() to resolve url() references from those modules. I’ll create a PR if I get motivated to do it myself.
meteor npm install --save @fontsource/oldenburg
mkdir -p public # -p in case you already have public as f
cd public
ln -s ../node_modules/@fontsource/oldenburg/files ./files
You can create a shellscript to automate this, since all @fontsource packages follow this structure.
Note: I used “Oldeburg” and monospace to better see, whether it has been applied or not.
Edit: I know this is still some kind of manually but if you really want this autmatically to be resolved I think you need to write an isobuild package that compiles css and takes care of any linked fonts by auto-linking it to the public folder in the build package output.
Hi @jkuester I had to use the TT Hoves font (https://typetype.org/fonts/tt-hoves/) on one of my project, which is not available in fontsource. Fontsource is great, but I think, that still must exists way to use custom fonts. Only what was working for me was copy fonts into the public folder and set path to public folder in scss files.
BUT: what was bigger problem, it was KendoUI (110+ jQuery Widgets - A Complete jQuery Components Library | Kendo UI), which is using own symbol font and fontface is placed in kendo’s CSS. …and I had to found the solution, how to override the kendo’s fontface CSS by my own CSS with changed font path (kendo font I was also coppied into public folder, override the css fontface and change font paths into public folder).