Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we need to resolve custom properties? #972

Open
samanpwbb opened this issue Mar 30, 2021 · 1 comment
Open

Do we need to resolve custom properties? #972

samanpwbb opened this issue Mar 30, 2021 · 1 comment

Comments

@samanpwbb
Copy link
Contributor

samanpwbb commented Mar 30, 2021

With #970 - our browser support targets all support css custom properties. Should we revise our build system to convert the variables option to a set of :root CSS properties? Would save us from needing to resolve every variable in our CSS at build time.

Are there costs to doing this? Likely compressed file size would not be impacted but could time to first paint take a hit? Here's an article on CSS variable performance, but it exclusively discusses the performance of changing variables at runtime: https://lisilinhart.info/posts/css-variables-performance/ and after some quick looking, couldn't find any existing documentation of the performance cost of using variables.

@katydecorah
Copy link
Contributor

I haven't come across anything that suggests that CSS variables could negatively impact performance. In examining performance, I've recently started creating reduced tests sites on staging and running Lighthouse (via CLI/script) to compare a change before and after (running Lighthouse 5 times to counter variability and then taking the average). I've found this practice helpful since I can quantify the impact and use that as a driver for making decisions.

Also, CSS variables can make introducing a dark theme easier (ref #954) if we decide to add that in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants