Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Emotion: Adding support for css prop without the need for jsx pragma … #172

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ngomezc
Copy link

@ngomezc ngomezc commented Jul 31, 2019

Current Issue
Currently, you have to use the code block below in any React component that uses to wish the CSS Prop for Emotion (rather than via styled method).

Currently:

/** @jsx jsx */
import { jsx } from '@emotion/core'

See https://emotion.sh/docs/css-prop for more details.

Emotion prescribes using the "@emotion/babel-preset-css-prop" babel preset in order to avoid this. However, this does not currently work with Typescript as discussed on the following issue (or as seen by simpling trying to implement it).

emotion-js/emotion#1046

Proposed Changes
The proposed changes use the solution described here in order to support the use of the css prop without the need for the pragma statement. This only affects the packages used and the webpack presets/plugins used slightly. All functionality is intact.

Motivation
I think it's important to support both Emotion methodologies (CSS Prop and Styled Components) and doing so without the boiletplate currently needed in order to use the former.

@tzarger
Copy link

tzarger commented Sep 22, 2019

@nickgofly This seems to break Antd (Ant Design) ... have you used Antd with this repo and your update?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants