MCPcopy Create free account
hub / github.com/donghaxkim/react-rewrite / parseThemeBlock

Function parseThemeBlock

packages/cli/src/tailwind-resolver.ts:13–26  ·  view source on GitHub ↗
(css: string)

Source from the content-addressed store, hash-verified

11 * Returns a flat Record mapping "--property-name""value".
12 */
13export 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

Callers 2

resolveV4ConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected