Skip to content

Commit

Permalink
Improve docs for emotion plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanbanov committed Jul 7, 2021
1 parent b50b310 commit 00b9f72
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions website/pages/docs/getting-started/migrate-from-emotion.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -221,30 +221,27 @@ To avoid the `/** @jsx jsx */` you can use `@xstyled/babel-preset-emotion-css-pr

You may want to use [Emotion Babel plugin](https://emotion.sh/docs/babel) for minification of styles, dead code elimination, components as selectors, and a nicer debugging experience.

You have to specify xstyled inside the `importMap`:

**.babelrc**

```js
{
...,
"plugins": [
"presets": [
[
"@emotion/babel-plugin",
"@xstyled/babel-preset-emotion-css-prop",
{
"importMap": {
"@xstyled/emotion": {
"default": {
"canonicalImport": ["@emotion/styled", "default"]
}
}
}
// @emotion/babel-plugin options
// https://emotion.sh/docs/@emotion/babel-plugin
}
]
]
}
```

Note: `importMap` has some known issues coming from Emotion side
- [Emotion not compatible with styled.box](https://github.com/gregberge/xstyled/issues/286)
- [CSS prop doesnt have access to the theme](https://github.com/gregberge/xstyled/issues/285)

### Difference in `css` prop usage

`css` prop with `@xstyled/emotion` is slightly different from `css` prop with `@emotion/react`.
Expand Down

0 comments on commit 00b9f72

Please sign in to comment.