Skip to content

Commit 139104b

Browse files
authored
fix(compiler-sfc): use prependLeft to handle CSSVars (#7760)
1 parent b9dc1ad commit 139104b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/compiler-sfc/__tests__/cssVars.spec.ts

+17
Original file line numberDiff line numberDiff line change
@@ -255,5 +255,22 @@ describe('CSS vars injection', () => {
255255
)
256256
expect(cssVars).toMatchObject([`count.toString(`, `xxx`])
257257
})
258+
259+
// #7759
260+
test('It should correctly parse the case where there is no space after the script tag', () => {
261+
const { content } = compileSFCScript(
262+
`<script setup>import { ref as _ref } from 'vue';
263+
let background = _ref('red')
264+
</script>
265+
<style>
266+
label {
267+
background: v-bind(background);
268+
}
269+
</style>`
270+
)
271+
expect(content).toMatch(
272+
`export default {\n setup(__props, { expose }) {\n expose();\n\n_useCssVars(_ctx => ({\n "xxxxxxxx-background": (_unref(background))\n}))`
273+
)
274+
})
258275
})
259276
})

0 commit comments

Comments
 (0)