Skip to content

Commit

Permalink
fix(compiler-ssr): correct the variable name generated by the generat…
Browse files Browse the repository at this point in the history
…or (#2065)
  • Loading branch information
HcySunYang authored Sep 15, 2020
1 parent 7455dca commit aa8dc9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions packages/compiler-ssr/__tests__/ssrInjectCssVars.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('ssr: inject <style vars>', () => {
const { ssrResolveCssVars: _ssrResolveCssVars, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _cssVars = ssrResolveCssVars({ color: _ctx.color })
const _cssVars = _ssrResolveCssVars({ color: _ctx.color })
_push(\`<div\${_ssrRenderAttrs(_mergeProps(_attrs, _cssVars))}></div>\`)
}"
`)
Expand All @@ -26,7 +26,7 @@ describe('ssr: inject <style vars>', () => {
"const { ssrResolveCssVars: _ssrResolveCssVars, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _cssVars = ssrResolveCssVars({ color: _ctx.color })
const _cssVars = _ssrResolveCssVars({ color: _ctx.color })
_push(\`<!--[--><div\${
_ssrRenderAttrs(_cssVars)
}></div><div\${
Expand All @@ -48,7 +48,7 @@ describe('ssr: inject <style vars>', () => {
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _component_foo = _resolveComponent(\\"foo\\")
const _cssVars = ssrResolveCssVars({ color: _ctx.color })
const _cssVars = _ssrResolveCssVars({ color: _ctx.color })
_push(\`<!--[--><div\${_ssrRenderAttrs(_cssVars)}></div>\`)
_push(_ssrRenderComponent(_component_foo, _cssVars, null, _parent))
_push(\`<!--]-->\`)
Expand All @@ -66,7 +66,7 @@ describe('ssr: inject <style vars>', () => {
const { ssrResolveCssVars: _ssrResolveCssVars, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _cssVars = ssrResolveCssVars({ color: _ctx.color })
const _cssVars = _ssrResolveCssVars({ color: _ctx.color })
if (_ctx.ok) {
_push(\`<div\${_ssrRenderAttrs(_mergeProps(_attrs, _cssVars))}></div>\`)
} else {
Expand All @@ -91,7 +91,7 @@ describe('ssr: inject <style vars>', () => {
const { ssrResolveCssVars: _ssrResolveCssVars, ssrRenderAttrs: _ssrRenderAttrs } = require(\\"@vue/server-renderer\\")
return function ssrRender(_ctx, _push, _parent, _attrs) {
const _cssVars = ssrResolveCssVars({ color: _ctx.color }, \\"data-v-foo\\")
const _cssVars = _ssrResolveCssVars({ color: _ctx.color }, \\"data-v-foo\\")
_push(\`<div\${_ssrRenderAttrs(_mergeProps(_attrs, _cssVars))} data-v-foo></div>\`)
}"
`)
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-ssr/src/ssrCodegenTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function ssrCodegenTransform(ast: RootNode, options: CompilerOptions) {
)
context.body.push(
createCompoundExpression([
`const _cssVars = ${ssrHelpers[SSR_RESOLVE_CSS_VARS]}(`,
`const _cssVars = _${ssrHelpers[SSR_RESOLVE_CSS_VARS]}(`,
varsExp,
options.scopeId ? `, ${JSON.stringify(options.scopeId)}` : ``,
`)`
Expand Down

0 comments on commit aa8dc9a

Please sign in to comment.