Nested @font-face results in invalid syntax
See original GitHub issueInput:
.foo {
@font-face {
font-family: "Ionicons";
src:url("../fonts/ionicons.eot?v=1.4.0");
src:url("../fonts/ionicons.eot?v=1.4.0#iefix") format("embedded-opentype"),
url("../fonts/ionicons.ttf?v=1.4.0") format("truetype"),
url("../fonts/ionicons.woff?v=1.4.0") format("woff"),
url("../fonts/ionicons.svg?v=1.4.0#Ionicons") format("svg");
font-weight: normal;
font-style: normal;
}
}
Result:
@font-face {
.foo {
font-family: "Ionicons";
src: url("../fonts/ionicons.eot?v=1.4.0");
src: url("../fonts/ionicons.eot?v=1.4.0#iefix") format("embedded-opentype"), url("../fonts/ionicons.ttf?v=1.4.0") format("truetype"), url("../fonts/ionicons.woff?v=1.4.0") format("woff"), url("../fonts/ionicons.svg?v=1.4.0#Ionicons") format("svg");
font-weight: normal;
font-style: normal; } }
Could I put the font-face outside? Certainly, but what I am attempting here to wrap an entire stylesheet (imports and all) in an outer selector, to provide a stylesheet for an embeddable widget that must not clobber any other styles on the page. I can move fonts outside the top-level selector, but it does make my stylesheets more awkward, and I have to break them up more.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:7
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Sass – Nested @font-face results in invalid syntax | UIthought
Just wanted to share one issue which I have faced recently with my current angular-cli project. Basically, issue related to the @font-face ......
Read more >Python: Nested if SyntaxError: invalid syntax - Stack Overflow
Generally, if you get syntax errors when your code is valid, it's either due to the line above or due to bad indentation....
Read more >font-family - CSS: Cascading Style Sheets - MDN Web Docs
The font-family CSS property specifies a prioritized list of one or more font ... Syntax. /* A font family name and a generic...
Read more >Using with Preprocessors - Tailwind CSS
By default, it uses the postcss-nested plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support...
Read more >mjml-guides – Documentation for MJML - The Responsive ...
Get your speed and productivity boosted with MJML's semantic syntax. Say goodbye to endless HTML table nesting or email client specific CSS.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi Guys, this is abnormal behavior. Sometimes it’s impossible to wrap directives into @at-root. Example: I’m using font-awesome and want to restrict it by wrapping into higher order css class to prevent css class name collisions ( I need to embed my site into another one where the same libraries could be used with different overrides).
Does this work for you?