How One PostCSS Plugin Solved a Four-CSS-System Migration Without Touching Components
Design engineer James Coombs faced the challenge of migrating a large frontend from Material UI to a custom design system built on Radix and Tailwind CSS 4, requiring four CSS systems to coexist simultaneously in the same bundles. Three component-level isolation approaches — manual class prefixing, runtime class modification, and Shadow DOM — were each considered and rejected before the team explored a solution at the CSS configuration level. Using the PostCSS plugin postcss-prefix-selector, every generated selector was scoped under a wrapper class during the build process, allowing the new design system's styles to win via CSS specificity without touching the roughly 960 existing component files. The approach required five PostCSS plugins running in sequence, including a step to strip @layer declarations so design-system rules could compete at normal cascade priority against unlayered legacy CSS. React portals — used by dialogs, tooltips, and dropdowns rendering outside the scope wrapper — were the one exception, each requiring a single targeted edit to maintain correct styling.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in