News for hackers. Stuff that matters.
Re:Why I'm Excited About Native CSS Variables by khgvljhkb on Monday December 07, 2015 @07:22AM (#10688959)
Being able to manipulate these from JS would be great. Then compile-to-js languages (Clojurescript & Elm) can use their (better) programming model for styles as well.
Re:Why I'm Excited About Native CSS Variables by err4nt on Monday December 07, 2015 @10:19AM (#10689956)
If you're looking for a way to use JavaScript variables directly in CSS styles there is an Element Query polyfill that includes that feature: http://codepen.io/tomhodgins/pen/MKWOWW

You can reference one line of JS in your CSS style, and the returned value is what is output in your CSS at the time the (responsive) style applies. This value can be a Js variable set elsewhere on the page, the output of a function, or a string or single line of JavaScript that is evaluated in-place.

The var() feature is new and only in the v1.0.0 branch right now, but to read about the other features of this plugin check out https://github.com/eqcss/eqcss and http://elementqueries.com