I'm building an Electron app that needs to run on Windows. The stack exists of React + Typescript, SCSS + TailwindCSS. The style is compiled with postcss. The Electron app is built with electron-builder
.
After compiling the style, creating new Electron installer for Windows and running this installer the included font's don't seem to work.
When checking the build
folder that functions as the output folder for electron-builder
, all font files are present in the static/media
folder. If I check the link to the font files when the Electron app is running, the link in the CSS also links to the generated static
folder where the files are.
Files & code
src/assets/font/
;.ttf
, .woff
, woff2
, .svg
and .eot
available;@font-face {
font-family: 'Montserrat';
font-weight: 500;
src: url('../font/Montserrat-Medium.ttf') format('truetype'),
url('../font/Montserrat-Medium.woff2') format('woff2'),
url('../font/Montserrat-Medium.woff') format('woff'),
url('../font/Montserrat-Medium.svg') format('svg'),
url('../font/Montserrat-Medium.eot') format('eot');
}
@font-face {
font-family: 'Montserrat';
font-weight: 700;
src: url('../font/Montserrat-Bold.ttf') format('truetype')
url('../font/Montserrat-Bold.woff2') format('woff2'),
url('../font/Montserrat-Bold.woff') format('woff'),
url('../font/Montserrat-Bold.svg') format('svg'),
url('../font/Montserrat-Bold.eot') format('eot');
}
theme: {
fontFamily: {
sans: ['Montserrat', 'sans-serif'],
body: ['Montserrat'],
bold: ['Montserrat']
},
... rest of config file
Facts
sans-serif
font.Checked resource
@font-face
).Questions
installer.exe
that is created with electron-builder
, do you need to include an assets folder and/or other files in the installation folder (e.g.: builder-effective-config.yaml
)?All resources I currently found say it should work when using @font-face
.
Note: if you require more information, please let me know and I'll provide it.
Ok, after a little more testing/checking the issue was the React build. It loaded an older configuration, that was breaking the font load.
Thanks all who read it!