MCPcopy Create free account
hub / github.com/angular/angular / namespaceCssVariables

Function namespaceCssVariables

packages/compiler/src/shadow_css.ts:1050–1066  ·  view source on GitHub ↗
(cssText: string)

Source from the content-addressed store, hash-verified

1048 * E.g. `--global--mycolor: red;` becomes `--mycolor: red;`
1049 */
1050export function namespaceCssVariables(cssText: string): string {
1051 return cssText.replace(_cssVariableRe, (match, leadingVar, varName, trailingColon) => {
1052 // Check for a leading `var(` or trailing `:` to approximate whether we're operating on a
1053 // real CSS variable, not another piece of syntax that resembles it. For example, this
1054 // guards against:
1055 // - `.foo--bar {}`
1056 // - `/* --foo */`
1057 // - `p { content: "--foo" }`
1058 // - `[data---bar] {}`
1059 // - `[data-status=foo--bar] {}`
1060 // etc.
1061 if (!leadingVar && !trailingColon) {
1062 return match;
1063 }
1064 return (leadingVar ?? '') + namespaceCssVariable(varName) + (trailingColon ?? '');
1065 });
1066}
1067
1068export class CssRule {
1069 constructor(

Callers 2

shadow_css_spec.tsFile · 0.90

Calls 2

namespaceCssVariableFunction · 0.90
replaceMethod · 0.45

Tested by

no test coverage detected