Skip to content

Css extraction atomization#573

Draft
davesnx wants to merge 8 commits intomainfrom
cursor/css-extraction-atomization-7b05
Draft

Css extraction atomization#573
davesnx wants to merge 8 commits intomainfrom
cursor/css-extraction-atomization-7b05

Conversation

@davesnx
Copy link
Owner

@davesnx davesnx commented Feb 6, 2026

Introduce CSS extraction and atomization logic with a new CLI tool and tests, building on main.

This PR splits the CSS extraction and atomization logic from the start-extraction-clean branch. It includes:

  • Transform.re: Handles CSS selector resolution, unnesting, and at-rule processing, adapted for main's AST.
  • Render.re: Decouples rule_list from Resolve.resolve_selectors for independent rendering.
  • Css_file.re: Provides an in-memory buffer, rule deduplication, and atomization into unique class names via Murmur2 hashing, without interpolation logic.
  • generate CLI tool: Extracts [@@@css ...] attributes from source files to produce a combined CSS output.
  • Transform_test.ml: Adds 46 test cases for the new transformation logic.
    Excluded are Property_to_type, interpolation, and other parser/ppx refactorings from the source branch. All existing tests pass, with one pre-existing failure on main.

Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Feb 6, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Feb 6, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
styled-ppx Ignored Ignored Preview Feb 19, 2026 1:02pm

@davesnx davesnx force-pushed the cursor/css-extraction-atomization-7b05 branch from 3b83c91 to 76285ca Compare February 12, 2026 21:35
cursoragent and others added 8 commits February 19, 2026 12:29
- Add Transform.re: CSS selector resolution with className support,
  including unnesting, at-rule handling, and split_by_kind
- Decouple Render.rule_list from Resolve.resolve_selectors so rendering
  and resolution are independent operations
- Update Render_test.re to explicitly call Resolve before Render

Co-authored-by: David Sancho <davesnx@users.noreply.github.com>
- Buffer: in-memory accumulator for CSS rules during compilation
- Css_transform: atomizes rules into individual declarations with unique
  classNames derived from content hashes (Murmur2)
- push/push_keyframe/push_global/get: API for collecting and retrieving
  extracted CSS

Co-authored-by: David Sancho <davesnx@users.noreply.github.com>
- generate.ml: reads .ml/.pp.ml files and extracts [@@@css] attributes
  into a CSS output file
- Supports --output and --verbose flags
- packages/bin/dune: add explicit modules field for coexistence

Co-authored-by: David Sancho <davesnx@users.noreply.github.com>
- 46 test cases covering selectors, ampersand nesting, combinators,
  pseudo-elements, attribute selectors, media queries, @supports,
  and edge cases
- Tests use minified render format matching main's Render output

Co-authored-by: David Sancho <davesnx@users.noreply.github.com>
Restructure the package from a property-specific parser to a general CSS
grammar engine. Adds Levenshtein distance for typo suggestions, proper
interpolation extraction, spec module generation, and standard CSS value
types. Updates ppx to use the new package.
@davesnx davesnx force-pushed the cursor/css-extraction-atomization-7b05 branch from 76285ca to acd8034 Compare February 19, 2026 13:02
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.

2 participants

Comments