@barocss/server 0.8.0 → 0.8.1
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 +2 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -38,6 +38,7 @@ const tag = ssrStyleTag(css); // '<style data-barocss-ssr>…</style>': put it i
|
|
|
38
38
|
The output never contains `@layer` statements.
|
|
39
39
|
- The result is one ordered sheet (#267): each referenced theme var once, each `@property` block once, rules in Tailwind variant order.
|
|
40
40
|
- Also exported: `ssrStyleTag(css, { nonce })`, `SSR_STYLE_ATTRIBUTE`.
|
|
41
|
+
- **Inlining CSS into HTML: use the helper.** Wrap server output with `ssrStyleTag(css)` (or, where a framework takes a string, apply the same end-tag escaping as the Next.js example below). Never interpolate raw CSS into `<style>${css}</style>`.
|
|
41
42
|
|
|
42
43
|
**Next.js App Router** (a server component; `html` is the CMS or model markup you render):
|
|
43
44
|
|
|
@@ -54,7 +55,7 @@ export default async function Page() {
|
|
|
54
55
|
}
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
Don't give this `<style>` a `precedence` or `href`, so React leaves it where it is. It only has to come before the content it styles. When you render components rather than an HTML string, pass the class list instead: `runtime.generateCssForHtml(['p-4 sm:p-6', …], { skip: BUILD_CSS })`.
|
|
58
|
+
The `.replace(/<\/style/gi, '<\\/style')` is what `ssrStyleTag` does for you: raw CSS inlined into HTML must never contain a markup end-tag sequence, or it could close the `<style>` element early. Don't give this `<style>` a `precedence` or `href`, so React leaves it where it is. It only has to come before the content it styles. When you render components rather than an HTML string, pass the class list instead: `runtime.generateCssForHtml(['p-4 sm:p-6', …], { skip: BUILD_CSS })`.
|
|
58
59
|
|
|
59
60
|
**Astro, SSR** (`src/middleware.ts`; read the emitted build CSS once at startup):
|
|
60
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barocss/server",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/barocss/barocss.git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
|
-
"@barocss/kit": "0.8.
|
|
29
|
+
"@barocss/kit": "0.8.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"vite": "^7.1.3",
|