I recently set up a custom font in my project like this:
$font-path: '~@/assets/fonts/';
@font-face {
font-family: 'mainFont';
font-weight: 300;
font-style: normal;
src: url('#{$font-path}mainFont/mainFont.eot') format('eot'),
url('#{$font-path}mainFont/mainFont.woff2') format('woff2'),
url('#{$font-path}mainFont/mainFont.woff') format('woff'),
url('#{$font-path}mainFont/mainFont.ttf') format('truetype'),
url('#{$font-path}mainFont/mainFont.svg#mainFont') format('svg');
}
Despite the fact that the build, which is created with vue.js webpack, seems to be functioning properly, the application is unable to load the fonts due to incorrect directory references in the src
URLs.
Following suggestions to make the $font-path
relative to the output file's folder (as recommended), the build fails as it cannot locate the fonts.