Skip to content

Commit f9ce926

Browse files
authored
fix(tailwind): Keep custom class-names (#923)
Co-authored-by: Promise <>
1 parent fdb49ce commit f9ce926

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/tailwind/src/tailwind.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ export const Tailwind: React.FC<TailwindProps> = ({ children, config }) => {
8787
domNode.attribs.class = domNode.attribs.class
8888
// remove all non-responsive classes (ex: m-2 md:m-4 > md:m-4)
8989
.split(" ")
90-
.filter((className) => className.search(/^.{2}:/) !== -1)
90+
.filter((className) => {
91+
const cleanedClassName = className.replace(cleanRegex, "_");
92+
return (
93+
className.search(/^.{2}:/) !== -1 ||
94+
!cssMap[`.${cleanedClassName}`]
95+
);
96+
})
9197
.join(" ")
9298
// replace all non-alphanumeric characters with underscores
9399
.replace(cleanRegex, "_");

0 commit comments

Comments
 (0)