-
Hey everyone! We've run into a pretty strange issue with Tailwind's purging, where classes are purged while they shouldn't. Or rather, it's certain classes, like Lets say we have to following React component: import { merge } from "@utilities/merge";
import React, { FC, PropsWithChildren } from "react";
type Props = {
size?: "small" | "large";
};
export const Test: FC<PropsWithChildren<Props>> = ({ size = "small", children }) => {
return <div className={merge([
"tw-relative",
size === "small" ? "tw-pr-1.5" : "tw-pr-2",
])}>
{children}
</div>;
}; and also the following Tailwind config:
So far so good. Running
(although I'm a bit surprised about the Now, we're in the context of a component library and a consuming app. So there's a build process in place for the components. When built (with Vite) the resulting code looks like this. You can clearly see that the two classes
and running
but I think either that's a bug in Tailwind's purging, or I'm missing something significant. Sorry for the long text. 😅 I didn't know how to explain this any simpler. Thanks for reading and—hopefully—replying! Edit: I just discovered the same behaviour for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@SamuelAlev has found a solution to this and opened a Pull Request: #7481 |
Beta Was this translation helpful? Give feedback.
@SamuelAlev has found a solution to this and opened a Pull Request: #7481