4.0.0 • Published 7 years ago

react-app-rewire-emotion v4.0.0

Weekly downloads
67
License
MIT
Repository
github
Last release
7 years ago

react-app-rewire-emotion

Add emotion/babel babel plugin to create-react-app using react-app-rewired

Add the emotion/babel to create-react-app app via react-app-rewired

Installation

yarn add --dev react-app-rewire-emotion

OR

npm install --save-dev react-app-rewire-emotion

Usage

In the config-overrides.js you created for react-app-rewired add this code:

const { rewireEmotion } = require('react-app-rewire-emotion');

/* config-overrides.js */
module.exports = function override(config, env) {
  return rewireEmotion(config, env, { inline: true });
}

If you are using compose utility provided by react-app-rewired to add multiple rewires, use this code:

const { compose } = require('react-app-rewired');
const { createEmotionRewire } = require('react-app-rewire-emotion');

/* config-overrides.js */
module.exports = function override(config, env) {
  const rewires = compose(
    createRewireForSomeOtherPlugin(),
    // ... place more rewires
    createEmotionRewire({ inline: true }),
  );
  return rewires(config, env);
};

Usage with Storybook

When using @storybooks/storybook with CRA via getstorybook, create a webpack.config.js file in .storybook folder and add this code:

const rewireEmotion = require('react-app-rewire-emotion');

module.exports = function override(config, env) {
  return rewireEmotion(config, env, { inline: true });
};

Inspirations

react-app-rewire-styled-components by @mxstbr

License

Licensed under MIT License, Copyright @ 2017 osdevisnot. See LICENSE.md for more details.

4.0.0

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

1.0.0-0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.1

7 years ago