purgecss
purgecss copied to clipboard
Tailwind v3 extractor
Is your feature request related to a problem? Please describe. Now that Tailwind 3 is really close I think we should update Docs for a custom Tailwind extractor that works.
Describe the solution you'd like With Tailwind 2 we could have used a default extractor that they made available in an internal file, but it was not a public API and in fact it is gone now: https://github.com/tailwindlabs/tailwindcss/discussions/6162.
What to do with Tailwind 3?
Using extractor copied from Tailwind internals changes code from this:
*,
:after,
:before {
border: 0 solid;
box-sizing: border-box;
}
:after,
:before {
--tw-content: "";
}
to this
* {
border: 0 solid;
box-sizing: border-box;
}
which is totally wrong (especially for Tailwind 3).
This might be related to https://github.com/FullHuman/purgecss/issues/653
I've also noticed that the default extractor doesn't work for Tailwind's "arbitrary values" syntax.
e.g. if I have text-[10px]
, it ends up getting stripped.
(For what it's worth, defaultExtractor: (content) => content.match(/[\w-/:[\]]+(?<!:)/g) || [],
did the trick for me for the arbitrary values issue.)
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Please no.
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
Nope
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.
I would also like this feature :)
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.