Skip to content

[Feature] Implement Deep CSS & Tailwind Variable Scanning #1

@ameghcoder

Description

@ameghcoder

The Problem
Currently, Regify is excellent at extracting class names and metadata using AST (ts-morph), but it misses the "styling source of truth." If a component uses a custom variable like bg-[--fysk-primary] or var(--radius), the generated registry item is incomplete because the raw CSS values are not captured.

To make Regify the ultimate "one-click" registry tool, we need to bridge the gap between the component code and the CSS files.

Proposed Solution
We need to implement a "Variable Resolver" that performs the following steps:

  1. Usage Detection: During the existing ts-morph scan, identify any strings that use var(--name) or Tailwind's arbitrary value syntax -[--name].
  2. CSS Crawling: Locate the project's entry CSS file (e.g., globals.css) and follow any @import statements to build a full variable map.
  3. Tailwind v4 Support: Specifically parse the @theme blocks in CSS to extract variables that Tailwind v4 automatically turns into utility classes.
  4. Registry Mapping: Inject these found values into the cssVars (light/dark/theme) fields of the shadcn registry JSON.

Technical Task List

  • CSS Crawler: Implement a recursive function to find and read all imported CSS files.
  • Variable Parser: Use Regex or a lightweight CSS parser to extract :root, .dark, and @theme variable definitions.
  • Integration: Update the extractClasses logic to flag "Variable-dependent" classes.
  • Output Mapping: Map variables to the cssVars object in the final registry-item.json.

Why this matters
Without this, users still have to manually copy-paste their theme colors and border-radius values into their registry. With this, Regify becomes truly autonomous.

Are you a contributor? I have already built the core ts-morph extraction logic. If you are comfortable with CSS parsing or regex-based file crawling, I’d love to collaborate on this part!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions