Externally imported contents in CSS files have strings escaped (content:'\xxx' dont render right) #10302
Labels
Upstream
Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Bug report
css content strings added for icons appear as stings not as icons
Describe the bug
a css class defined as
.a::before { content: '\f054'; }
dont render the icon, instead some text is displayed
A clear and concise description of what the bug is.
To Reproduce
USe this code sandbox to view the issue and a probable workaround with scss
https://codesandbox.io/s/async-wind-uj7z6
Steps to reproduce the behavior, please provide code snippets or a repository:
a::before { content: '\f054'; }
import css from "../style/a.css";
<style jsx>{css}</style>
in the component to render the styleseg:
<a>Hi</a>
Expected behavior
The icon should render instead of the text
Screenshots
If applicable, add screenshots to help explain your problem.
System information
-package.json dev deps
"devDependencies": { "cross-env": "^5.2.0", "node-sass": "^4.7.2", "sass-loader": "7.1.0" },
-next.config.js
`
module.exports = {
webpack: (config, { defaultLoaders }) => {
config.module.rules.push({
test: /.scss|css$/,
use: [
defaultLoaders.babel,
{
loader: require('styled-jsx/webpack').loader,
options: {
type: 'scoped'
}
},
'sass-loader'
]
})
}
`
Additional context
Seems like a issue related to the style-jsx version that is bundled
vercel/styled-jsx#589, i have commented my findings and workaround in that issue as well
The text was updated successfully, but these errors were encountered: