@font-face wrong syntax
Hey guys,
I'm stuck on this problem all day long and I can't find a way to solve this, could you help me please? If minimized is enabled, than the @font-face is stripped out, but if I disable it, the final file comes with a wrong syntax, like this:
@font-face {
{
font-family: 'whatsgood-fonticon'
;
src: url(../fonts/whatsgood-fonticon.eot)
;
src: url(../fonts/whatsgood-fonticon.eot#iefix) format("embedded-opentype"), url(../fonts/whatsgood-fonticon.ttf) format("truetype"), url(../fonts/whatsgood-fonticon.woff) format("woff"), url(../fonts/whatsgood-fonticon.svg#whatsgood-fonticon) format("svg")
;
font-weight: normal
;
font-style: normal
}
}
Pretty strange, I will take a look later, but this approach works!
@font-face {
font-family: 'whatsgood-fonticon';
src: url('./whatsgood-fonticon.eot?pqypst');
src: url('./whatsgood-fonticon.eot?pqypst#iefix') format('embedded-opentype'),
url('./whatsgood-fonticon.ttf?pqypst') format('truetype'),
url('./whatsgood-fonticon.woff?pqypst') format('woff'),
url('./whatsgood-fonticon.svg?pqypst#whatsgood-fonticon') format('svg');
font-weight: normal;
font-style: normal;
}
:global {
[class^="wg-"], [class*=" wg-"] {
font-family: 'whatsgood-fonticon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.wg-add:before {
content: "\e900";
}
.wg-arrow-down:before {
content: "\e901";
}
}
Struggling with a similar issue, any quick workaround guys?. I disabled minimizing, but it still adds an extra bracket which browser is not able to parse.
@font-face { { font-family: 'TypoGraphica'; font-style: normal; font-weight: normal; src: url(http://localhost:3001/src/styles/fonts/TypoGraphica.otf) format("opentype"); } }
rahilvirani did you tried my solution above? It worked for me.
I've got same problem. After few mins of research, i found that it adds one more bracket if you put your font-face into :global scope.
:global { @font-face { ... } }
Put them out and you will be fine.
/cc @renanvalentin @rahilvirani @nindavidw can your create minimal reproduced test repo if error is present or we can close this issue?
Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!
Hi @evilebottnawi ! I still have this issue as of today, it seems other people do too here : https://github.com/css-modules/css-modules/issues/95 @jmar777 describes the issue pretty well here : https://github.com/css-modules/css-modules/issues/95#issuecomment-369822016 So yeah, pretty annoying for anyone who tries to import an icon font for example.
Thanks a bunch for your work on this 👍 😄 !