unjs / fontaine

Automatic font fallback based on font metrics
MIT License
1.47k stars 23 forks source link

Usage with tailwind #280

Open MuhammadM1998 opened 9 months ago

MuhammadM1998 commented 9 months ago

🆒 Your use case

Update README to show usage with tailwind.

🆕 The solution you'd like

This is how I got it to work. The module adds the fallback fonts correctly but we need to tell tailwind the fallback font family name in order to actually use it.

// tailwind.config
module.exports = {
  theme: {
    extend: {
      fontFamily: {
        // For every font, provide another string in `${fontName} fallback` format
        plex: ["IBM Plex Sans Arabic", "IBM Plex Sans Arabic fallback"],
      },
    },
  },
};

🔍 Alternatives you've considered

No response

ℹī¸ Additional info

I'd make a PR if the solution sounds good

Lambdac0re commented 6 months ago

+1