Hasty Briefsbeta

Bilingual

How to use Satori with your Tailwind config

12 hours ago
  • Satori is a library for generating SVG files using React or Preact, ideal for image generation.
  • Satori comes with built-in Tailwind support but does not work with custom Tailwind config out-of-the-box.
  • Install dependencies: use Preact or React, and the 'tw-to-css' library to convert Tailwind classes to inline styles.
  • Import necessary modules and get a 'twj' function by pointing to your Tailwind config file.
  • Define an 'inlineTailwind' function that converts Tailwind classes into an object of inline styles for Satori.
  • Example usage: apply the 'inlineTailwind' function to your components to integrate custom Tailwind config with Satori.