Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lucleray/styled-components.macro

A `babel-plugins-macros` macro for styled-components
https://github.com/lucleray/styled-components.macro

babel-macros babel-plugin-macros styled-components

Last synced: 15 days ago
JSON representation

A `babel-plugins-macros` macro for styled-components

Awesome Lists containing this project

README

        

⚠️ This repo is not active. If you want a macro for styled-components, use [`styled-components/macro`](https://www.styled-components.com/docs/tooling#babel-macro).

---

## styled-components.macro 🎣

A `babel-plugin-macros` macro for `styled-components`.

### Usage

```js
import styled from 'styled-components.macro'

const Button = styled.button`
background: purple;
color: white;
`

// ...
```

### Setup for create-react-app

Create-react-app is shipped already including `babel-plugin-macros`, which makes it much easier to setup 🚀

1. Make sure you have already installed `styled-components` :

```
yarn add styled-components
```

2. Install this package :

```
yarn add styled-components.macro --dev
```

### General setup

1. Make sure you have already installed `styled-components` :

```
yarn add styled-components
```

2. Install `babel-plugin-macros` and add it to your babel config :

```js
// .babelrc
{
"plugins": ["macros"]
}
```

See [babel-plugin-macros docs](https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/user.md#babel-plugin-macros-usage-for-users) for more information about how to setup `babel-plugin-macros`.

3. Install this package :

```
yarn add styled-components.macro --dev
```

### More

This macro is using `babel-plugin-styled-components` to transform your code. See [babel-plugin-styled-components](https://github.com/styled-components/babel-plugin-styled-components) to see what transformations are applied.