import { css } from @motion/core upgrade issue #2484
Replies: 2 comments 2 replies
-
Note that previously |
Beta Was this translation helpful? Give feedback.
-
@Andarist Thank you for fast response! I definitely have jest snapshot tests running before update: "emotion": "10.0.27", "emotion-server": "10.0.27", "emotion-theming": "10.0.27", "@emotion/babel-preset-css-prop": "10.1.0", and `import { css } from '@emotion/core'; the code returning the string with css: return css`
// any pixel density (1x)
background-image: url(${mediaApiUrl({
url: smUrl,
format,
[resizeDimension]: sm,
})});
@media (min-width: 768px) {
background-image: url(${mediaApiUrl({
url: mdUrl,
format,
[resizeDimension]: md,
})});
// etc
}` I found a workaround with "@emotion/react": "11.4.1": return css`
// any pixel density (1x)
background-image: url(${mediaApiUrl({
url: smUrl || '',
format,
[resizeDimension]: sm,
})});
@media (min-width: 768px) {
background-image: url(${mediaApiUrl({
url: mdUrl || '',
format,
[resizeDimension]: md,
})});
}`.styles but in tests snapshot diff I see inconsistencies. First - it is a lot of empty spaces in css, and at the end of the string there is dangling invalid css attached:
extra spaces I can live with, but dangling label is too weird. |
Beta Was this translation helpful? Give feedback.
-
I have react.js project with emotion, and I'm upgrading it to current versions.
The issue for me is that
css
from@emotion/core
had been returning a string with css, but new version@emotion/css
'scss
returns a classname instead of minified css string.css
from@emotion/react
returnsSerializedStyles
, which is not a string at all, so my code and tests breaks for both exports.Is there some way to get previous behavior in new version?
Beta Was this translation helpful? Give feedback.
All reactions