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

[dev-mode, webpack] style-loader approach to injection results in css transitions triggering #2011

Open
runspired opened this issue Jul 2, 2024 · 0 comments

Comments

@runspired
Copy link

Given:

  • a style rule that contains a transition: e.g.
body {
  background-color: var(--main-bg-color);
  transition: background-color 1s ease-out;
}
  • a browser evaluation criteria that needs to be made on initial load: e.g.
@media (prefers-color-scheme: dark) {
  :root {
    --main-bg-color: var(--dark-grey);
  }
}

The style-loader approach used in development will result in the css transition triggering when it should not because of the dynamic insertion of the stylesheet.

In production, a static link is used which will not result in the transition triggering.

Since this is dev-mode only and the reason for using style-loader is dev performance, likely there's nothing to change here, but I felt this quirk should be documented for anyone else that stumbles upon it.

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

No branches or pull requests

1 participant