MCPcopy Index your code
hub / github.com/coder/coder / extractEffectiveBlock

Function extractEffectiveBlock

site/src/theme/cssVariables.test.ts:105–121  ·  view source on GitHub ↗
(css: string, selector: string)

Source from the content-addressed store, hash-verified

103}
104
105function extractEffectiveBlock(css: string, selector: string): string | null {
106 const block = extractBlock(css, selector);
107 if (block === null) {
108 return null;
109 }
110
111 if (!selector.startsWith(".") || !selector.includes("-")) {
112 return block;
113 }
114
115 const themeName = selector.slice(1) as ConcreteThemeName;
116 const baseBlock = extractBlock(css, `.${baseModeFor(themeName)}`);
117 if (baseBlock === null) {
118 return null;
119 }
120 return `${baseBlock}\n${block}`;
121}
122
123describe("theme CSS variables", () => {
124 const cssPath = path.resolve(__dirname, "../index.css");

Callers 1

Calls 2

extractBlockFunction · 0.85
baseModeForFunction · 0.85

Tested by

no test coverage detected