Repository navigation
refactor(infima): convert the Infima sources to plain CSS, build them without dependencies - #13086
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Change: Refactor Merge Risk:
|
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: +257 B (0%) Total Size: 12.1 MB 📦 View Changed
ℹ️ View Unchanged
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Size Change: +257 B (0%) Total Size: 12.1 MB 📦 View Changed
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
… without dependencies Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3de5e32 to
fea7a2b
Compare
Motivation
@docusaurus/infimacompiled its.pcsssources with 10 PostCSS plugins, including unmaintained ones (postcss-each,postcss-for,postcss-color-mod-functionfor the removedcolor-mod()), a pinnedpostcss-preset-envv7 alias, and apostcssoverride to fix their CVEs.This PR converts the sources once to plain CSS, and replaces the build with a dependency-free script. The visual output doesn't change.
styles/**/*.pcss→styles/**/*.css, same files and order.@each,@for, the mixins,^&and nesting are expanded.color-mod()colors are precomputedrgb()values, as they were in the output. Stylelint and oxfmt now check them.scripts/build.mjsonly inlines the@importrules ofstyles/infima.cssintodist/infima.css, and still flips it with rtlcss intodist/infima-rtl.css.devDependenciesof the package (onlyrtlcssstays), their 10catalog:deventries and thepostcss: ^8.5.28override. Compared tomain, the whole stack's lockfile only swapsinfimafor@docusaurus/infimaand itsrtlcss.Options considered
&__linkanyway. The site bundler already runspostcss-preset-envand Lightning CSS with the site's Browserslist on every CSS file, Infima included: it adds the vendor prefixes and fallbacks the site needs, so Infima doesn't need to bake in its own.@custom-media, but it removes comments, including the/*rtl:raw:*/directive that rtlcss needs since meta/docusaurus#13085. Nesting would only help for pseudo-classes and media queries.postcss-import+postcss-nesting): keeps a dependency for little gain over 1.color-mix()instead of the precomputed colors: changes the behavior: shades would follow a site's--ifm-color-primary, which changes, for example, the alerts of sites that only override some shades.Differences in
dist/infima.cssNormalized with Lightning CSS, each declaration compared:
-webkit-/-moz-), the:link/:visited/area[href]and:-moz-any-linkfallbacks of:any-link, thegrid-gapfallback,word-wrap→overflow-wrap. That's the job of the site'spostcss-preset-env: in the website's final CSS, only the:any-linkfallback rules andgrid-gapremain different.@custom-media --ifm-narrow-windowis inlined as(max-width: 996px).--ifm-font-family-basekeeps the font stack expanded bypostcss-preset-envv7 (Segoe UI, Roboto, Ubuntu…aftersystem-ui): removing it could change the per-glyph font fallback.rgb(0 0 0 / 10%)instead ofrgba(0, 0, 0, 0.1),::afterinstead of:after.Rule order:
postcss-sort-media-queriesmoved all media queries to the end of the file, andpostcss-combine-duplicated-selectorsmerged duplicated rules into the first one. The new sources keep media queries next to their component, so I checked every pair of conflicting declarations (same or overlapping property, same specificity and importance) whose order differs between the old and new output:.colrule must come after the.col--*rules (otherwisecol col--6doesn't stack on mobile). It's now at the end ofgrid.css, with a comment..heroand.tabs): they only matter for an element with both classes, which no markup of the theme or website has.Test Plan
dist/infima.css, on top of meta/docusaurus#13085:styles.css: same cascade, differences listed above/infima/**pages and 14 main pages, desktop light/dark and mobile: 107 of 108 are pixel-identical./blogdiffers between two runs of the same build too (lazy-loaded images)dist/infima-rtl.css: same cascade as the old RTL file, the breadcrumb separator still rotatespnpm lint,pnpm build:packagesmain, so it includes the whole stack): the only screenshot change is the docs text edited by meta/docusaurus#13085, which has the same change. The text snapshots changestyles.css, as expectedstyles.cssgrows by 257 B (+0.18%): each component keeps its own@mediaand:rootblocks (19 and 28) instead of the 6 and 2 merged onesTest links
Deploy preview: https://deploy-preview-13086--docusaurus-2.netlify.app/infima
Related issues/PRs
Stacked on meta/docusaurus#13085, which switches theme-classic to
@docusaurus/infimafrom meta/docusaurus#13082.🤖 Generated with Claude Code
Summary by CodeRabbit