@typestyles/next 0.0.0-unstable.6c696fbd20ce → 0.0.0-unstable.7a7b2125c991
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 +23 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -150,6 +150,23 @@ To ship a static `typestyles.css` and avoid client-side `<style>` injection (use
|
|
|
150
150
|
|
|
151
151
|
`withTypestylesExtract` sets **`NEXT_PUBLIC_TYPESTYLES_RUNTIME_DISABLED`** via `next.config` `env` (works with **webpack and Turbopack**) and adds webpack **`DefinePlugin`** for `__TYPESTYLES_RUNTIME_DISABLED__` on client bundles when webpack runs. Example app: `examples/next-app`.
|
|
152
152
|
|
|
153
|
+
### Runtime in development, zero-runtime in production
|
|
154
|
+
|
|
155
|
+
During `next dev`, keeping the client runtime **enabled** avoids tying every style tweak to a pre-build extraction step. In production, disable injection so the browser loads one cacheable stylesheet.
|
|
156
|
+
|
|
157
|
+
```js
|
|
158
|
+
// next.config.mjs
|
|
159
|
+
import { withTypestylesExtract } from '@typestyles/next/build';
|
|
160
|
+
|
|
161
|
+
const base = {
|
|
162
|
+
/* your config */
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export default process.env.NODE_ENV === 'production' ? withTypestylesExtract(base) : base;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
You still typically generate `typestyles.css` before production builds (CI or `prebuild`). The example app uses this pattern.
|
|
169
|
+
|
|
153
170
|
## API Reference
|
|
154
171
|
|
|
155
172
|
### getRegisteredCss
|
|
@@ -266,9 +283,11 @@ import { tokens } from 'typestyles';
|
|
|
266
283
|
import { getRegisteredCss } from '@typestyles/next';
|
|
267
284
|
|
|
268
285
|
const darkTheme = tokens.createTheme('dark', {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
286
|
+
base: {
|
|
287
|
+
color: {
|
|
288
|
+
background: '#1a1a1a',
|
|
289
|
+
text: '#ffffff',
|
|
290
|
+
},
|
|
272
291
|
},
|
|
273
292
|
});
|
|
274
293
|
|
|
@@ -276,7 +295,7 @@ export default function RootLayout({ children }) {
|
|
|
276
295
|
const css = getRegisteredCss();
|
|
277
296
|
|
|
278
297
|
return (
|
|
279
|
-
<html className={darkTheme}>
|
|
298
|
+
<html className={darkTheme.className}>
|
|
280
299
|
<head>{css && <style dangerouslySetInnerHTML={{ __html: css }} />}</head>
|
|
281
300
|
<body>{children}</body>
|
|
282
301
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typestyles/next",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.7a7b2125c991",
|
|
4
4
|
"description": "Next.js integration for typestyles SSR",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"react": "^18.0.0",
|
|
78
78
|
"react-dom": "^18.0.0",
|
|
79
79
|
"tsup": "^8.0.0",
|
|
80
|
-
"typestyles": "0.0.0-unstable.
|
|
80
|
+
"typestyles": "0.0.0-unstable.7a7b2125c991",
|
|
81
81
|
"typescript": "^5.4.0",
|
|
82
82
|
"webpack": "^5.97.1"
|
|
83
83
|
},
|