MCPcopy
hub / github.com/vuejs/core / genNormalScriptCssVarsCode

Function genNormalScriptCssVarsCode

packages/compiler-sfc/src/style/cssVars.ts:196–216  ·  view source on GitHub ↗
(
  cssVars: string[],
  bindings: BindingMetadata,
  id: string,
  isProd: boolean,
  defaultVar: string,
)

Source from the content-addressed store, hash-verified

194// <script setup> already gets the calls injected as part of the transform
195// this is only for single normal <script>
196export function genNormalScriptCssVarsCode(
197 cssVars: string[],
198 bindings: BindingMetadata,
199 id: string,
200 isProd: boolean,
201 defaultVar: string,
202): string {
203 return (
204 `\nimport { ${CSS_VARS_HELPER} as _${CSS_VARS_HELPER} } from 'vue'\n` +
205 `const __injectCSSVars__ = () => {\n${genCssVarsCode(
206 cssVars,
207 bindings,
208 id,
209 isProd,
210 )}}\n` +
211 `const __setup__ = ${defaultVar}.setup\n` +
212 `${defaultVar}.setup = __setup__\n` +
213 ` ? (props, ctx) => { __injectCSSVars__();return __setup__(props, ctx) }\n` +
214 ` : __injectCSSVars__\n`
215 )
216}

Callers 1

processNormalScriptFunction · 0.90

Calls 1

genCssVarsCodeFunction · 0.85

Tested by

no test coverage detected