wip: simplify useCssVars

This commit is contained in:
Evan You
2020-11-17 13:03:47 -05:00
parent dfac6eee99
commit f92bc5a19a
6 changed files with 46 additions and 77 deletions

View File

@@ -52,7 +52,7 @@ export function genCssVarsCode(
id: string
) {
const varsExp = `{\n ${vars
.map(v => `${convertCssVarCasing(v)}: (${v})`)
.map(v => `"${id}-${convertCssVarCasing(v)}": (${v})`)
.join(',\n ')}\n}`
const exp = createSimpleExpression(varsExp, false)
const context = createTransformContext(createRoot([]), {
@@ -72,7 +72,7 @@ export function genCssVarsCode(
})
.join('')
return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}), "${id}")`
return `_${CSS_VARS_HELPER}(_ctx => (${transformedString}))`
}
// <script setup> already gets the calls injected as part of the transform