Just a quick heads-up since writing this, Tailwind 4.1 was released which introduced a new way to safelist classes using brace expansion. It works pretty much the same as what I show in the blog, but instead of using a .txt file, you can do it inline directly in the @source directive.
Both approaches are totally valid depending on what you need.
Just a quick heads-up since writing this, Tailwind 4.1 was released which introduced a new way to safelist classes using brace expansion. It works pretty much the same as what I show in the blog, but instead of using a .txt file, you can do it inline directly in the
@source
directive.Both approaches are totally valid depending on what you need.
You can check it out here: https://tailwindcss.com/blog/tailwindcss-v4-1#safelist-specific-utilities-with-source-inline