const count = ref(0)
const style = { color: 'red' }
+ const height = ref(0)
return (_ctx, _push, _parent, _attrs) => {
const _cssVars = { style: {
"--xxxxxxxx-count": (count.value),
- "--xxxxxxxx-style\\\\.color": (style.color)
+ "--xxxxxxxx-style\\\\.color": (style.color),
+ "--xxxxxxxx-height\\\\ \\\\+\\\\ \\\\\\"px\\\\\\"": (height.value + "px")
}}
_push(\`<!--[--><div\${
_ssrRenderAttrs(_cssVars)
import { ref } from 'vue'
const count = ref(0)
const style = { color: 'red' }
+ const height = ref(0)
</script>
<template>
<div>{{ count }}</div>
<style>
div { color: v-bind(count) }
span { color: v-bind(style.color) }
+ span { color: v-bind(height + "px") }
</style>
`,
{
expect(content).not.toMatch(`useCssVars`)
expect(content).toMatch(`"--${mockId}-count": (count.value)`)
expect(content).toMatch(`"--${mockId}-style\\\\.color": (style.color)`)
+ expect(content).toMatch(
+ `"--${mockId}-height\\\\ \\\\+\\\\ \\\\\\"px\\\\\\"": (height.value + "px")`,
+ )
assertCode(content)
})
doubleEscape: boolean,
): string {
return key.replace(cssVarNameEscapeSymbolsRE, s =>
- doubleEscape ? `\\\\${s}` : `\\${s}`,
+ doubleEscape ? (s === '"' ? '\\\\\\"' : `\\\\${s}`) : `\\${s}`,
)
}