Skip to content

Best option to load fonts locally #376

@silverliiv

Description

@silverliiv

Hey, recently found out about WordPlate, started to use it and now I'm hooked. Super simple setup with great performance and developer experience.

I'm just having some smaller issues/problems setting up the fonts to load locally.

What I've done currently:
I have installed the fonts locally (to my computer), so they will work on my browser.

For server setup:
I've included a separate fonts file and loaded them using @font-face -- but I need to comment/uncomment for the production (npm run build). It feels potentially a crucial error, when I forget to uncomment the line (attached a screenshot).
image

All of this is happening in the index.js entry file, all other CSS & JS files are coming from there as well.

Solution 1:
I could load the fonts from a CDN, like Google Fonts, but I prefer to have them locally setup (meaning on clients own server).

Preferred solution:
Simply include the fonts in relative paths and all works in DEV & Production environment.

On dev:
CSS path: resources/css/fonts.css
JS path: resources/js/index.js
Fonts path: resources/static/fonts

On Production:
CSS path: public/themes/wordplate/assets/index-6debf16b.css
JS path: public/themes/wordplate/assets/index-5889fd27.js
Fonts path: public/themes/wordplate/assets/fonts

I tried all kinds of paths, but couldn't get it to work. Not sure what I'm missing.

This setup works for production:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions