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

Custom css can not maintain single-quote using lightningcss #849

Closed
GiveMe-A-Name opened this issue Nov 1, 2024 · 1 comment
Closed

Comments

@GiveMe-A-Name
Copy link

The css code:

h1 {
  user-select: none;
  color: v-bind('color ? "red": "green"');
}

After lightningcss transform, the custom css would be double-quoted first.
The single-quoted can't be maintained.

h1 {
  user-select: none;
  color: v-bind("color ? \"red\": \"green\"");
}

v-bind("color ? \"red\": \"green\"") would transform into color: var(--7ba5bd90-color\ \?\ \\\"red\\\"\:\ \\\"green\\\"); by vue-loader. It's not expected.

Example in Lightningcss playground

Reference issue: web-infra-dev/rsbuild#3595 (comment)

@GiveMe-A-Name GiveMe-A-Name changed the title Custom css can not maintain using lightningcss Custom css can not maintain single-quote using lightningcss Nov 1, 2024
@devongovett
Copy link
Member

That's not valid CSS afaik. You should run Vue-loader before lightingcss so it is compiled first.

Or Vue loader should be more resilient. The output CSS is equivalent according to the CSS spec. Which quotes you use should not matter.

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

No branches or pull requests

2 participants