Hi, what is the best way to add fonts with Sage 9?
I’ve added the font folder in assets/fonts/ but then I don’t know how to declare it with WebPack so it copies those font files in the dist folder.
Any idea?
Thanks a lot
ps: Sage 9 looks really good already! The workflow has been seriously improved!
Just add fonts in assets/fonts/ also don’t forget @font-face rules in scss and after building (npm run build) all fonts with @font-face rule should appear in dist/fonts folder.
Hi thanks your reply, it succefuly copies the font files in dist/fonts/Ostia/OstiaAnticaWeb-Italic.eot but when I set the src for that font face such as:
The same happens with the production version with fontawesome for example:
http://*******.net/app/themes/SDB/dist/vendor/fontawesome-webfont_b06871f2.ttf Failed to load resource: the server responded with a status of 404 (Not Found)
I’m not lucky there sorry. Even the fontawesome public links aren’t working out for me:
http://***.net/app/themes/SDB/dist/vendor/fontawesome-webfont_b06871f2.ttf
Failed to load resource: the server responded with a status of 404 (Not Found)
But neither work. publicPath is definitely “publicPath”: “/app/themes/SDB”,
I don’t know what I’m doing wrong there.
By the way I cannot npm build on the server since OVH won’t let me have SSH with my current plan. I’m transferring the necessary files via ftp, it’s a massive pain.
Files I’m transferring when updating are template and dist, other files are already there such as src/ assets/ vendor/ could this be the problem?
I know this is an old post, but maybe my findings will help somebody.
If you are using sage 9 (not Bedrock or Trellis), you need to change publicPath from “app/theme/[name_of_theme]” to "wp-content/theme/[name_of_theme]"
found in resources/assets/config.json