Expand description
CSS/SCSS file parsing and CSS Module class name extraction.
Handles @import, @use, @forward, @plugin, @apply, @tailwind directives,
and extracts class names as named exports from .module.css/.module.scss files.
Extraction is a deliberate hybrid, not a half-finished migration. lightningcss
owns the membership decision for standard CSS (which .token occurrences are
genuine class selectors, via lightningcss_class_set); the regex scanners own
span location and the entire SCSS path. lightningcss parses standard CSS only,
not SCSS syntax (@use, @forward, // line comments, $variables), so SCSS
files are gated away from the parser and the regex chain stays as permanent
infrastructure rather than a transitional step toward an all-parser tokenizer.
Structs§
- CssImport
Source - A CSS import source with both the literal source and fallow’s resolver-normalized form.
- Theme
Scan - Result of scanning a CSS source for Tailwind v4
@themeblocks. - Theme
Token Def - A Tailwind v4
@themetoken definition: the custom-property name WITHOUT the leading--(e.g.color-brand) and its 1-based line in the source.
Functions§
- extract_
apply_ tokens - Extract the utility tokens referenced in
@applydirective bodies across a CSS source (comment / string masked).@apply rounded-card font-bold;yields["rounded-card", "font-bold"]. The leading-!and trailing-!important modifiers and a bare!importanttoken are stripped, so a theme token whose utility is applied only via@applyis credited as used. - extract_
css_ import_ sources - Extract
@import/@use/@forward/@pluginsource paths from a CSS/SCSS string. - extract_
css_ imports - Extract normalized
@import/@use/@forward/@pluginsource paths from a CSS/SCSS string. - extract_
css_ module_ exports - Extract class names from a CSS module file as named exports.
- scan_
theme_ blocks - Scan a CSS source for Tailwind v4
@themeblocks, returning the defined design tokens plus the custom properties read viavar()inside those blocks.