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

Global style keyframes injection #208

Merged
merged 2 commits into from
Sep 10, 2020
Merged

Conversation

peduarte
Copy link
Contributor

Fixes #185

This PR:

  • ensures that css.global are server rendered
  • ensures that css.keyframes are server rendered

Breaking change:
In order to be able to inject global styles, we need to make that a function.

const globalStyles = css.global({})

// call it
globalStyles()

in React

const globalStyles = css.global({})

const App = () => {
  // call here
  globalStyles()

  return <div/>
}

We could provide a nicer API, maybe a hook, in @stitches/react

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5d217c4:

Sandbox Source
Stitches CI: Next.js Configuration
Stitches CI: CRA Configuration

@peduarte peduarte merged commit bef0c97 into canary Sep 10, 2020
@peduarte peduarte deleted the global-style-keyframes-injection branch September 10, 2020 20:07
@peduarte
Copy link
Contributor Author

This is fixed in 0.0.3-canary.1

yarn add @stitches/[email protected]`

Note, this release contains the following breaking change:

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

Successfully merging this pull request may close these issues.

Global styles not working with SSR
1 participant