Adapt Figma Text Style Guide into TailwindJs Config

 Problem:

Manually updating the tailwind.js config can be a tedious task, especially when changes occur or when setting up configurations for the first time. As frontend developers, it might feel like we're more data entry personnel, transferring Figma tokens into the tailwind.js config file for every color and typography.



Solution:


1) Transfer Colors Using CSS Variables.

Utilize the "Export your styles to CSS variables" Figma plugin, available here. This plugin generates CSS variables from Figma, allowing for easy copying, pasting, and slight reformatting. Incorporate these variables into the Tailwind.js theme colors [theme.extend.colors] in the tailwind.config.js file.



2) Transfer Typographies Using CSS Mixins

Utilize the "CSSgen" Figma plugin, accessible here, to generate CSS mixins. After generating the mixins, reformat them slightly and include them as custom components in the tailwind.config.js file.


Example for Solution 2) is here, how it looks like
















Finally,

We can use our project text style guide directly from the VScode autocomplete. 🔥












Bonus Script


Comments

Popular Posts