[css] Use CSS custom properties imported via @import
See original GitHub issueIs it possible for VS code to recognize CSS variables declared in a separate CSS file that is imported with @import
?
For example, I would like to have a variables.css
file that is all about declaring CSS custom properties. Then I would import that file on top of my main css file, and be able to have intellisense support for those variables.
The way things work now, VSCode is not able to recognize those variables. Or maybe I am missing something obvious?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:119
- Comments:25 (2 by maintainers)
Top Results From Across the Web
import - CSS: Cascading Style Sheets - MDN Web Docs
The @import CSS at-rule is used to import style rules from other valid stylesheets. An @import rule must be defined at the top...
Read more >Importing global css custom variables - Stack Overflow
Basically I want any css that imports theme-variable to be able to access these css custom properties and resolve to static values using...
Read more >CSS @import Rule - W3Schools
@import url("navigation.css"); /* Using a url */ ... The numbers in the table specify the first browser version that fully supports the property....
Read more >CSS Custom Properties (vars) with SASS/SCSS, a practical ...
CSS Custom Properties (vars) with SASS/SCSS, a practical architecture strategy · When using a prefixed CSS Custom Prop with SCSS you have to...
Read more >CSS Variables for React Devs - Josh W Comeau
The thing that makes CSS variables different from typical CSS properties is that we can access their values, using the var() function. This...
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
I vote for the feature too. It’s quite confusing when you can not find a variable within suggestions popup while it’s declared in one of the linked files, especially when it’s in
:root
pseudo-class (so it’s available throughout your project). Right now it’s appeared in suggestions popup only in the file where the custom property is defined.It would be great if the popup could show on typing
--
not only the variable’s name and value but also some kind of modifier that explains where the variable is declared: in:root
, inherited from parent or it comes right from this selector where it’s used (probably in terms of sorting this kind of custom properties should have higher priority). Also, the modifier mentioning overriding (‘Root value is overridden in ‘name’ selector’ or something like this) would be useful.How do I cast my vote for this feature? I am very interested in it as well.