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

RFC: Add babel preset for css prop #1049

Merged
merged 15 commits into from
Dec 14, 2018
Merged
Prev Previous commit
Next Next commit
Add pragmaFrag option
emmatown committed Dec 4, 2018
commit 1c3b376058f7de26ffe058e8019d660636106cfb
14 changes: 8 additions & 6 deletions packages/babel-preset-css-prop/__tests__/__fixtures__/index.js
Original file line number Diff line number Diff line change
@@ -2,11 +2,13 @@ import * as React from 'react'

export let Button = props => {
return (
<button
css={{
color: 'hotpink'
}}
{...props}
/>
<>
<button
css={{
color: 'hotpink'
}}
{...props}
/>
</>
)
}
Original file line number Diff line number Diff line change
@@ -5,12 +5,14 @@ exports[`@emotion/babel-preset-css-prop index 1`] = `

export let Button = props => {
return (
<button
css={{
color: 'hotpink'
}}
{...props}
/>
<>
<button
css={{
color: 'hotpink'
}}
{...props}
/>
</>
)
}

@@ -30,12 +32,12 @@ var _ref = process.env.NODE_ENV === \\"production\\" ? {
} : {
name: \\"1v4u9bq-Button\\",
styles: \\"color:hotpink;label:Button;\\",
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUtNIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnXG5cbmV4cG9ydCBsZXQgQnV0dG9uID0gcHJvcHMgPT4ge1xuICByZXR1cm4gKFxuICAgIDxidXR0b25cbiAgICAgIGNzcz17e1xuICAgICAgICBjb2xvcjogJ2hvdHBpbmsnXG4gICAgICB9fVxuICAgICAgey4uLnByb3BzfVxuICAgIC8+XG4gIClcbn1cbiJdfQ== */\\"
map: \\"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU1RIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgUmVhY3QgZnJvbSAncmVhY3QnXG5cbmV4cG9ydCBsZXQgQnV0dG9uID0gcHJvcHMgPT4ge1xuICByZXR1cm4gKFxuICAgIDw+XG4gICAgICA8YnV0dG9uXG4gICAgICAgIGNzcz17e1xuICAgICAgICAgIGNvbG9yOiAnaG90cGluaydcbiAgICAgICAgfX1cbiAgICAgICAgey4uLnByb3BzfVxuICAgICAgLz5cbiAgICA8Lz5cbiAgKVxufVxuIl19 */\\"
};

export let Button = props => {
return ___EmotionJSX(\\"button\\", _extends({
return ___EmotionJSX(React.Fragment, null, ___EmotionJSX(\\"button\\", _extends({
css: _ref
}, props));
}, props)));
};"
`;
2 changes: 1 addition & 1 deletion packages/babel-preset-css-prop/src/index.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ export default ({
import: pragmaName
}
],
[jsx, { pragma: pragmaName, ...options }],
[jsx, { pragma: pragmaName, pragmaFrag: 'React.Fragment', ...options }],
[
emotion,
{