Skip to content

Add css-winner-diff script to compare cascade winners between stylesheets - #599

Closed
davesnx wants to merge 2 commits into
generate-dependency-orderfrom
css-winner-diff
Closed

davesnx wants to merge 2 commits into
generate-dependency-orderfrom
css-winner-diff

Conversation

@davesnx

@davesnx davesnx commented Sep 18, 2026

Copy link
Copy Markdown
Owner

scripts/css-winner-diff.ts OLD.css NEW.css [--summary] compares two stylesheets emitted by styled-ppx.generate and reports every pair of rules with the same property, specificity and at-rule wrapper but different selectors whose relative order changed, which is exactly the set of cascade ties whose winner flips. It exists to review ordering changes in the aggregator; the exit code is always 0.

Evidence at 79a3d70:

  • node scripts/css-winner-diff.ts --self-test: all assertions pass; a 25,000-rule synthetic input completes in about 1.3 s.
  • A real 8,648-rule stylesheet compared with itself: 356,464 tied pairs compared, 0 flipped.
  • The monorepo's aggregated output in source order against dependency order (23,273 rules each): 2,410,908 tied pairs compared, 736,147 flipped, 0 unparsed lines.

Node 22 runs the file directly with no dependencies. Not part of the opam package.

Risk: two-way door. Tooling only; a revert removes the script and nothing else depends on it.

@vercel

vercel Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
styled-ppx Ignored Ignored Preview Sep 22, 2026 12:34pm UTC

Request Review

@davesnx

davesnx commented Sep 22, 2026

Copy link
Copy Markdown
Owner Author

Dropped: the winner-diff script was a one-off evaluation tool with no callers in the repo. Its results stay recorded in the generate-dependency-order plan.

@davesnx davesnx closed this Sep 22, 2026
@davesnx
davesnx deleted the css-winner-diff branch September 22, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant