#Tailwind integration output serves font as base64, leading to bloated css in production

1 messages · Page 1 of 1 (latest)

turbid burrow
#

In my project (see link below), the official integration @astrojs/tailwind generates two css files:

  • File A
    18.1KB.
    It contains all the utility classes I use in my project.
    This is expected!

  • File B
    40.1KB.
    It contains exactly the same content as File A, but with font-faces, because I use Inter.
    And the @font-face part is super bloated, because it serves font as base64: src: url(data:font/woff2;base64,[LONG LONG LONG BASE64])

When I run tailwind -o build.css --minify manually, I only got file A (18.1KB).
Is this an expected behavior? If not:

  • Why Astro generates two identical css files rather than one, as --minify does?
  • Why is the font served as base64?

My source code: https://github.com/mrcaidev/portfolio
Deployed on Vercel: https://mrcai.dev (Check DevTool Network tab, and see 404.[hash].css(18.1KB) and about.[hash].css(40.1KB))

I'm particularly concerned about the performance of my website, so this is very important to me. Thank you🙏

GitHub

Yuwang Cai's personal homepage. Contribute to mrcaidev/portfolio development by creating an account on GitHub.

Yuwang Cai's homepage.

turbid burrow