Sidwebworks
Sidwebworks

Reputation: 120

How to whitelist or Safelist, attribute selectors with purgeCSS (Tailwindcss)?

I am trying to use a Tailwindcss RTL plugin, which generates some classes starting with [dir=rtl] or [dir=ltr]. But due to Purge CSS is removing it regardless of it's use.

Upvotes: 3

Views: 1646

Answers (1)

Sidwebworks
Sidwebworks

Reputation: 120

Here is how I solved this Because pure CSS is dumb, it looks for the strings that match the content it needs to purge. So to fool it, we can simply add the classes or attributes which we want to be saved.

like this

<main class="[dir=rtl] [dir=ltr] container">
{some content}
</main> 

Upvotes: 1

Related Questions