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

Error character problems caused by pseudo-class content being escaped #179

Open
ZaneL1u opened this issue Feb 4, 2022 · 2 comments
Open

Comments

@ZaneL1u
Copy link

ZaneL1u commented Feb 4, 2022

Hello!

I found in my use that once the content of the pseudo-class has the '\' symbol, it will be escaped to the wrong '' character, which is reproduced below.

.iconfont:before {
  content: "\e600";
}

Then run:

const cssAST = csstree.parse(css)
const finalCSS = csstree.generate(cssPlain)

In the generated CSS, the expected result is escaped and will look like this:

.iconfont:before{content:""}
@thescientist13
Copy link

thescientist13 commented Jul 20, 2024

Just ran into this issue as well.

Here is a link to astexplorer.net that reproduces the issue
https://astexplorer.net/#/gist/fe3f7886b4638ffc5bf66275c54d3af5/d503c4abef9da04298ffeccba4fdaef733e34858
Screenshot 2024-07-20 at 7 30 51 PM

@thescientist13
Copy link

Just bumped into this again while experimenting with FontAwesome, which makes pretty heavy use of this pattern
https://unpkg.com/browse/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.css

.fa-circle-chevron-right::before {
  content: "\f138";
}

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