-
Notifications
You must be signed in to change notification settings - Fork 262
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
CSS content
property no longer renders encoded characters
#589
Comments
@HDTran have you tried with |
@giuseppeg i have the same issue; upgraded from 9.0.3 to 9.1.3
i have tried please advice ... until then rolling back |
Sorry for the troubles folks! Can you create a testcase in codesandbox or repository? This seems to be working https://codesandbox.io/s/hello-world-n1y2y |
@giuseppeg this is crazy ... i see your sandbox works however I forked it at https://codesandbox.io/s/hello-world-bpwbp and did nothing and it does not work: is there a bad cdn version of 9.1.3? |
I think the regression is due to #577. The following escape sequence is invalid and the code won't parse. `
div:after {
content: '\0025B6';
}
` The raw version of the string works of course: String.raw`
div:after {
content: '\0025B6';
}
` parses just fine. To avoid using `
div:after {
content: '\\0025B6';
}
` At this point the problem is that with #577 we use the Initially I made this change because @lfades reported that `content: '\`'` didn't work. Honestly I don't remember why. |
@giuseppeg #577 was a fix for a component like this one: const InlineCode = ({ color, children }) => (
<code>
{children}
<style jsx>
{`
code {
color: ${color ? color : '#bd10e0'};
}
code::before {
content: '\`';
}
code::after {
content: '\`';
}
`}
</style>
</code>
) That component was broken because of this line:
|
@HDTran @jschimmoeller I think I found the answer to this issue: babel/babel#1198 (comment) Basically you should use hex-based escapes otherwise the code won't parse and throw a syntax error when you use the octal format Maybe we can add this to the README? Not sure if it is worth trying to do the conversion ourselves i.e. allow you to use |
@giuseppeg i tried |
try with one backslash |
@giuseppeg i sent over an hour trying many different backslash options but nothing is working; one, two, and even 4. I even went over to the babel link and tried some of their options but nothing works |
@jschimmoeller you're right sorry I replied from my phone and didn't get a chance to test it. I guess then |
I have got the same issue too, initially thought that it was an issue with the sass-parser, |
I am using font awesome 5 code in next v9.2.0 |
Hi @jschimmoeller, |
This doesnt work locally, |
I have found a quick workaround for this until the issue is properly fixed, This will require the styles to be defined in SCSS. I your SCSS file need to replace all occurrences of You will also need to have a sass-loader imported on your package.json and next.config.js |
I'm experiencing the same issues with encoded chars in pseudo content, as with the OP i'm using Next (all the way up to 9.4.5-canary.10, using styled-jsx 3.3.0), and the only way I can get consistent behaviour across SSR/CSR/SSG is the OP's string-literal solution of
have tried all the other solutions and no matter how many slashes i add, there are bugs in at least one rendering approach. Things I've tried are:
|
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Old behavior now must be done through string-literal instead of standard string.
If the current behavior is a bug, please provide the steps to reproduce and possibly a minimal demo or testcase in the form of a Next.js app, CodeSandbox URL or similar
The following no longer works in NextJS 9.1.1 to render a encoded character:
We now have to do:
What is the expected behavior?
Standard way of rendering content should still work.
Environment (include versions)
Did this work in previous versions?
Yes
The text was updated successfully, but these errors were encountered: