Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can use CSS variables, no preprocessor necessary for newer browsers:

  :root {
    --palette-blue-light: blue;
  }
  background-color: var(--palette-blue-light);


Great suggestion, but due to extremely poor support [0], it might be best to use a polyfill [1]

[0] https://caniuse.com/#feat=css-variables [1] https://github.com/aaronbarker/css-variables-polyfill (or https://github.com/jhildenbiddle/css-vars-ponyfill)

Personally, I don't like forcing JS to make things render properly on the client, but it depends on the project whether it's acceptable or not.

However, it kind of defeats the purpose, because if you're willing to use a polyfill, then you may as well use sass or less as a solution anyway (and get a range of benefits that they provide).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: