Hacker News new | ask | show | jobs
by systemvoltage 1621 days ago
Unrelated but regarding SCSS/SASS: I am curious, why did we invent a new syntax for scss instead of writing a library in Python or Go that maps data-objects to CSS classes? You have full access to a proper programming language instead of this new DSL we need to learn. I tried searching for it but no luck, any reason why we don't do this?
3 comments

I can't speak for all features in SCSS/SASS. I'd prefer JS (for reusability) to Python, Go and DSLs, but why open Turing complete Pandoras box in the first place when declarative works so incredibly well?

Regular CSS didn't have variables for a long time, which was the killer use case imo. I haven't been in the loop for a while but just found out that there is a CSS Custom Properties[1] standard which would solve most of my use cases. Heck, they're even scoped! Imo front-end folks have an unhealthy low threshold for taking on dependencies that are already supported natively, imo.

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_c...

It's called interoperable css [0] or css modules [1].

[0] https://github.com/css-modules/icss

[1] https://github.com/css-modules/css-modules

> I am curious, why did we invent a new syntax for scss instead of writing a library in Python or Go that maps data-objects to CSS classes?

I mean, if using js/ts is not beneath you I'm pretty sure any css-in-js solution fits the bill.