Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
First of all, thanks for this theme!
My use case is this: I would like to be able to include tailwind classes as part of the content in Drupal to build pages in this way.
However tailwind only exports classes that I have previously included in twig templates, so if I have not used, for example: text-gray-500, it will not be available. Is there a way to prevent this behavior? In version 4 you can declare "purge" as false, but in version 5 it seems that it does not work the same way. Could you please tell me how to do it?
Thanks a lot!
Comments
Comment #2
opdaviesHi, @ktegory!
The 5.x branch is using Tailwind's JIT compiler, which you can find out more about at https://v2.tailwindcss.com/docs/just-in-time-mode, and for the
content
configuration at https://tailwindcss.com/docs/content-configuration.Something that I've done previously is keeping a separate file such as https://github.com/OliverDaviesLtd/oliverdavies-uk/blob/8203e983d5cc177b... that I can include within the purge/JIT settings to avoid classes from being removed, or you could do the same using a
safelist
within your Tailwind configuration.I did previously have some Tailwind classes inside body fields so I wrote an export command that dumps that data into a file like the one above. The command class is at https://github.com/OliverDaviesLtd/oliverdavies-uk/blob/f219d81d38cdcd60... if you wanted to take a look.
I hope that helps!