but that also can nowadays be achieved with the use of CSS properties.
Sure—but that still has a "we have let, what do we need const for" vibe to me.
I have worked in many projects that uses CSS properties in the way you are now explaining (set constant values), and I do not think the use of a pre-processor would be needed there either.
Ok—what if you're using SASS anyway—for source organization?
/* Somewhere in the "settings" layer (01) */$black:#000000;$white:#ffffff;/* Somewhere in the "generic" layer (03) */:root{--text-colour:#{$black};--bg-colour:#{$white};}@media(prefers-color-scheme:dark){:root{--text-colour:#{$white};--bg-colour:#{$black};}}
In this particular scenario CSS custom properties are only employed where dynamic (i.e. late, run-time) behaviour is required (communicating intent) and the fundamental, global colours and measures are collectively assembled in one place outside of any CSS.
Dynamic values are often based on static ones (which are perhaps even generated) and this maintains a nice separation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Sure—but that still has a "we have
let
, what do we needconst
for" vibe to me.Ok—what if you're using SASS anyway—for source organization?
(ITCSS)
In this particular scenario CSS custom properties are only employed where dynamic (i.e. late, run-time) behaviour is required (communicating intent) and the fundamental, global colours and measures are collectively assembled in one place outside of any CSS.
Dynamic values are often based on static ones (which are perhaps even generated) and this maintains a nice separation.