DEV Community

Discussion on: Can CSS variables be watched, (need a smart cookie)

Collapse
 
alvaromontoro profile image
Alvaro Montoro

Maybe you could use a MutationObserver?

But it would depend highly on what you are doing. Watching the value is not trivial and depends on many factors. Take into account that CSS variables can change their value in many different ways and within many different scopes.

Collapse
 
adam_cyclones profile image
Adam Crockett 🌀

This would do the trick 🥰