Skip to content

Commit

Permalink
chore: add extraction info to readme (#663)
Browse files Browse the repository at this point in the history
* chore: add extraction info to readme

* Update README.md
  • Loading branch information
Madou authored Mar 23, 2021
1 parent 9cdae7f commit c93fec2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,35 @@ const StyledButton = styled.button`
</ClassNames>
```

### Extract styles

Turn on extraction and all components styled in your app and sourced through NPM will have their runtime stripped and styles extracted to an atomic style sheet.

```diff
-import { CC, CS } from '@compiled/react/runtime';
-
-const _2 = '._syaz1q9v{color: hotpink}';
-const _ = '._1wybfyhu{font-size: 48px}';
-
export const LargeHotPinkText = () => (
- <CC>
- <CS>{[_, _2]}</CS>
<span className="_syaz1q9v _1wybfyhu">Hello world</span>
- </CC>
);
```

```css
._1wybfyhu {
font-size: 48px;
}
._syaz1q9v {
color: hotpink;
}
```

See [CSS extraction](https://compiledcssinjs.com/docs/css-extraction-webpack) for more information.

## Installation

Install the [React](https://reactjs.org/) package.
Expand Down

0 comments on commit c93fec2

Please sign in to comment.