(css: string)
| 11 | * Returns a flat Record mapping "--property-name" → "value". |
| 12 | */ |
| 13 | export function parseThemeBlock(css: string): Record<string, string> { |
| 14 | const tokens: Record<string, string> = {}; |
| 15 | const themeBlockRegex = /@theme\s*\{([^}]+)\}/g; |
| 16 | let match; |
| 17 | while ((match = themeBlockRegex.exec(css)) !== null) { |
| 18 | const block = match[1]; |
| 19 | const propRegex = /(--[\w-]+)\s*:\s*([^;]+);/g; |
| 20 | let propMatch; |
| 21 | while ((propMatch = propRegex.exec(block)) !== null) { |
| 22 | tokens[propMatch[1].trim()] = propMatch[2].trim(); |
| 23 | } |
| 24 | } |
| 25 | return tokens; |
| 26 | } |
| 27 | |
| 28 | // --------------------------------------------------------------------------- |
| 29 | // detectTailwindVersion |
no outgoing calls
no test coverage detected