-
Notifications
You must be signed in to change notification settings - Fork 6
Language server doesn't handle css.resolve
#58
Comments
Thanks for your report! @smores import css from 'styled-jsx/css'
const burgerStyles = css.resolve`
.some-class-name {
display: block;
position: absolute;
top: 2.5rem;
right: 2rem;
}
@media (min-width: 769px) {
.some-class-name {
display: none;
}
}
` |
Interesting! I wonder if this is a quirk of how css.resolve works: it does allow styles at the top level (without a tag)... but now that I'm looking more closely at the docs, this isn't actually a documented feature. This works just fine as is; here's a screenshot of my browser where these styles seem to have been applied correctly: But you're right that the docs suggest nesting these styles in a tag... I personally think that kind of stinks/breaks encapsulation, but I suppose it's fair that your extension doesn't support it given that it isn't documented! I just opened a thread on the styled-jsx discussion forum asking for clarification: vercel/vercel#6065. |
Related to the topic but not related to the issue of wrapping resolved styles in a className: In our code base we're destructuring the resolve`
...
` This doesn't trigger the syntax highlighting as it specifically looks for (If you feel this should be a separate issue just lmk.) |
Right, I think it is cleaner to use |
I never ended up getting any responses to that discussion thread.. just tried another tack and opened an issue on styled-jsx! |
Hello! I see that a previous issue (#16) called out a bug when a component uses
css.global
; I'm seeing what seems to be the same issue when usingcss.resolve
:Steps To Reproduce
css.resolve
The current behavior
Syntax highlighting and language server responses (autocomplete options) are incorrect/partially missing
The expected behavior
css.resolve
-tagged templates behave the same as<styled jsx>
tags andcss.global
-tagged-templates!The text was updated successfully, but these errors were encountered: