How we made our product more personalized with CSS Variables and React
Dan Bahrami
1285

Hi Dan,

Thanks for the write-up. I had a similar task for the company I work for.

You might be interested in a PostCSS plugin I developed that helps you create a fallback for browsers that do not support CSS Variables.

https://github.com/lochstar/postcss-extract-custom-properties

It extracts a list of variable names and the classes that reference them. With this you can insert a <style> tag per variable on to your page and update the property value dynamically.

I currently use it in production and as far as I know no one else has tried it, let me know if you find it useful.