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

Emotion preset update #197

Merged
merged 2 commits into from
Nov 21, 2020
Merged

Emotion preset update #197

merged 2 commits into from
Nov 21, 2020

Conversation

ben-rogerson
Copy link
Owner

This PR upgrades the { preset: "emotion" } option to use the new imports added in emotion@11 (released 12th Nov 2020). See #184 for more info.

Using the preset

Add { preset: "emotion" } to your twin config.
The css and GlobalStyles imports will import from @emotion/react.

Adding { preset: "emotion" } is the equivalent of this import config:

{
  preset: 'emotion',
  styled: {
    import: 'default',
    from: '@emotion/styled',
  },
  css: {
    import: 'css',
    from: '@emotion/react',
  },
  global: {
    import: 'Global',
    from: '@emotion/react',
  },
}

@emotion/core

Before version 11, the imports came from @emotion/core.
If you‘re using older versions then add these imports to your twin config:

{
  preset: 'emotion',
  styled: {
    import: 'default',
    from: '@emotion/styled',
  },
  css: {
    import: 'css',
    from: '@emotion/core',
  },
  global: {
    import: 'Global',
    from: '@emotion/core',
  },
}

@ben-rogerson ben-rogerson merged commit 4ad5d65 into master Nov 21, 2020
@ben-rogerson ben-rogerson deleted the feature/emotion-preset-update branch November 21, 2020 05:35
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.

1 participant