-
Notifications
You must be signed in to change notification settings - Fork 1
Description
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:
- Usage Detection: During the existing
ts-morphscan, identify any strings that usevar(--name)or Tailwind's arbitrary value syntax-[--name]. - CSS Crawling: Locate the project's entry CSS file (e.g.,
globals.css) and follow any@importstatements to build a full variable map. - Tailwind v4 Support: Specifically parse the
@themeblocks in CSS to extract variables that Tailwind v4 automatically turns into utility classes. - 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@themevariable definitions. - Integration: Update the
extractClasseslogic to flag "Variable-dependent" classes. - Output Mapping: Map variables to the
cssVarsobject in the finalregistry-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!