Open sizzlingwok opened 3 weeks ago
Hey @sizzlingwok,
Thank you for opening this issue.
So basically there's no public folder (in the serverless env) when deployed to CF Pages, hence you'd want to do something like following in your code:
---
import { join } from "node:path";
import { AstroFont } from "astro-font";
const fontPrefix = import.meta.env.PROD
? Astro.site.toString()
: join(process.cwd(), "public");
---
<AstroFont
config={[
{
name: "Editorial New",
src: [
{
style: "italic",
weight: "500",
path: join(
fontPrefix,
"fonts",
"PPEditorialNew-MediumItalic.woff2"
),
},
],
preload: true,
display: "swap",
selector: "body",
fallback: "sans-serif",
}
]}
/>
Do let me know how it turns out!
Everything is up to date. Site works locally. Cloudflare Pages builds without errorr. Steps to reproduce: Importing Astro Font and declaring all fonts in Layout.astro
astro.config.mjs