The solution to this is to treat CSS as a unit of code, like Javascript and before static analysis on the result.
Solutions like CSS Modules and Styled Components are getting _really_ really close. CSS Modules lets you do this at a component level, and is theoretically possible to do it at an individual class level (providing you use a 'safe' syntax).
Solutions like CSS Modules and Styled Components are getting _really_ really close. CSS Modules lets you do this at a component level, and is theoretically possible to do it at an individual class level (providing you use a 'safe' syntax).