Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue SRR renders newline characters into class attributes #7859

Closed
brophdawg11 opened this issue Mar 19, 2018 · 2 comments · Fixed by #8037
Closed

Vue SRR renders newline characters into class attributes #7859

brophdawg11 opened this issue Mar 19, 2018 · 2 comments · Fixed by #8037

Comments

@brophdawg11
Copy link

Version

2.5.16

Reproduction link

Gist

Steps to reproduce

  • Download the above gist to an index.js file
  • npm install --save vue vue-server-renderer
  • node index.js

What is expected?

Once rendered in the browser, all 6 long-classname-* class styles should be applied to the second element.

What is actually happening?

Because the class attribute is rendered with long-classname-3\n, the styles for long-classname-3 are not applied


This can be worked around by adding a space before the mid-attribute line break, however this doesn't play nicely with the ESLint no-trailing-spaces rule and the settings for many common editors.

@rogden
Copy link

rogden commented May 3, 2018

I'm experiencing this issue as well. Using Tailwind CSS in Vue SFCs, it is helpful to break the class names onto multiple lines to avoid long single lines. The \n character is breaking the class names. Hopefully this makes it into the next release.

brophdawg11 added a commit to brophdawg11/vue that referenced this issue May 4, 2018
When encountering newlines in SSR classnames, do not render "\n"" and
instead replace the new line with a space.

Once newlines are removed, indentation from subsequent lines can leave
classnames abnormally spaced out, so replace multiple spaces with a
single space

fix vuejs#7859
@brophdawg11
Copy link
Author

Finally got some time to dig into this and opened a PR: #8130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants