I’ll split the answer into two parts, come on
First:
Yes can and a lot. Performance can vary between various factors,
Including JS in this equation will generate even more delay in render time.
Second:
The quantity does not matter so much, but rather where it will be used and how much element it affects, a good practice would be to define variables for key points such as text changing size and fonts.
If your goal is even performance you can use simple and "lightweight" CSS processors like STYLUS.
References:
https://blog.jiayihu.net/css-custom-properties-performance-in-2018/
https://blog.teamtreehouse.com/getting-started-stylus
What exactly do you mean when you say
variáveis
?– MagicHat
@Magichat Thank you, updated my reply.
– Vinícius Lima
Dude I’ve read a few things about CSS variables, and I’ve never seen anything related to performance, but what you might take into consideration, if you’re doing a framework for example, is that
color: var(--example);
has a few more characters thancolor: red;
and this can increase theKBs
of your.CSS
. Of course it is an example for extreme cases with a . CSS with more than 10mil lines etc... Maybe with a Postcss or Webpacker you can configure the output of these variables– hugocsl