Hacker News new | ask | show | jobs
by paulintrognon 1842 days ago
You can address points 1 and 3 via (s)css modules.

But point 2 and 4 stand.

2 comments

You can also kind of address 4 by using `calc` and custom properties in CSS.

(eg: `margin-left: var(--page-margin);`)

We started using CSS in JS a few years ago because we couldn’t, and still are unable to use CSS variables (some of our customers still require IE11 support and we can’t drop it until 2022).

The main issue I still see with CSS variables is IDE support and static validation. With my CSS written in typescript I know that every variable I’ve imported works statically.

Point 2 is solved if you add TS to the css modules.