styled-components-jsx 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -17
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,23 +9,6 @@ Write styles like [`styled-components`](https://www.npmjs.com/package/styled-com
|
|
|
9
9
|
|
|
10
10
|
If you love the simplicity and performance of `styled-jsx` but prefer the ergonomic syntax of `styled-components`, this library gives you the best of both worlds.
|
|
11
11
|
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## 🚀 Installation
|
|
15
|
-
> ⚠️ Requires [`styled-jsx`](https://www.npmjs.com/package/styled-jsx) to be installed and configured in your app.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
With **Yarn**:
|
|
19
|
-
```bash
|
|
20
|
-
yarn add styled-components-jsx
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
With **npm**:
|
|
24
|
-
```bash
|
|
25
|
-
npm install styled-components-jsx
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
|
|
29
12
|
---
|
|
30
13
|
|
|
31
14
|
## ✨ Basic Usage
|
|
@@ -73,9 +56,79 @@ This library wraps your styles using `styled-jsx`, giving you:
|
|
|
73
56
|
- Support for both DOM elements and custom React components
|
|
74
57
|
- Automatic prop filtering (`$`-prefixed props are stripped from DOM)
|
|
75
58
|
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 🚀 Installation
|
|
62
|
+
|
|
63
|
+
> ⚠️ This package requires [`styled-jsx`](https://www.npmjs.com/package/styled-jsx) to be installed and properly processed by Babel.
|
|
64
|
+
> If you're using **Next.js**, it works with minimal configuration. For other setups (Vite, Webpack, etc.), you may need to configure Babel manually.
|
|
65
|
+
|
|
66
|
+
Install with **Yarn**:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
yarn add styled-components-jsx
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or with **npm**:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm install styled-components-jsx
|
|
76
|
+
```
|
|
76
77
|
|
|
77
78
|
---
|
|
78
79
|
|
|
80
|
+
### ✅ If you're using **Next.js**
|
|
81
|
+
|
|
82
|
+
Make sure to enable transpilation for this package inside your `next.config.js`:
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
// next.config.js
|
|
86
|
+
const nextConfig = {
|
|
87
|
+
transpilePackages: ['styled-components-jsx'],
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = nextConfig
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
This ensures that `styled-components-jsx` is properly handled by Next.js' Babel pipeline, including the `styled-jsx` plugin.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### ⚠️ If you're **not using Next.js**
|
|
98
|
+
|
|
99
|
+
You must ensure that your Webpack (or Vite/Rollup) build pipeline:
|
|
100
|
+
|
|
101
|
+
- Applies **Babel** to `node_modules/styled-components-jsx`
|
|
102
|
+
- Includes the [`styled-jsx/babel`](https://www.npmjs.com/package/styled-jsx#with-babel) plugin
|
|
103
|
+
|
|
104
|
+
Here's a minimal Babel config example:
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"presets": ["@babel/preset-react", "@babel/preset-typescript"],
|
|
109
|
+
"plugins": ["styled-jsx/babel"]
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
And in Webpack:
|
|
114
|
+
|
|
115
|
+
```js
|
|
116
|
+
module.exports = {
|
|
117
|
+
module: {
|
|
118
|
+
rules: [
|
|
119
|
+
{
|
|
120
|
+
test: /\.tsx?$/,
|
|
121
|
+
include: /node_modules\/styled-components-jsx/,
|
|
122
|
+
use: 'babel-loader',
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
|
|
79
132
|
## 🛠 Configuration
|
|
80
133
|
|
|
81
134
|
For full setup (e.g., Babel, SSR, Next.js), refer to the [`styled-jsx` documentation](https://github.com/vercel/styled-jsx).
|
package/package.json
CHANGED