gregsullivan / _tw

The _tw generator creates a WordPress starter theme optimized for modern development with Tailwind CSS, Tailwind Typography and the WordPress editor.
https://underscoretw.com
GNU General Public License v2.0
543 stars 30 forks source link

classes in editor blocks not compiled #3

Closed jmyt8 closed 3 years ago

jmyt8 commented 3 years ago

Hi, I was testing the theme and it works well with templates, but utitlity classes added in glutenberg blocks or html blocks don't get compiled. Is there any solution for this?

Great theme!

gregsullivan commented 3 years ago

Sorry for the late response on this—I'm embarrassed to admit my GitHub notification settings were incorrect, and I only saw your issue today.

Unfortunately, the nature of Tailwind's purge process (see Tailwind's documentation on Optimizing for Production for details) makes it less than ideal if you'd like to use utility classes within the block editor.

One workaround would be to create a safelist of classes that you want to use in the block editor, which will prevent them from being purged. But if you'd like to be able to use arbitrary Tailwind classes in the block editor without limits, the only option would be not to use purging, which would result in a very large CSS file.

Hope that helps—please let me know if you have any other questions!