@barocss/server 0.7.0 → 0.8.0

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.
Files changed (2) hide show
  1. package/README.md +9 -1
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -60,6 +60,14 @@ Don't give this `<style>` a `precedence` or `href`, so React leaves it where it
60
60
 
61
61
  ```ts
62
62
  import { defineMiddleware } from 'astro:middleware';
63
+ import { ServerRuntime, ssrStyleTag } from '@barocss/server';
64
+ const runtime = new ServerRuntime({
65
+ cssVarPrefix: 'tw', // always, next to a Tailwind build
66
+ // from the build's `@custom-variant dark (...)`: shadcn -> '.dark &',
67
+ // `[data-theme=dark]` variant -> '[data-theme=dark] &', none -> omit (default 'media')
68
+ darkMode: 'class',
69
+ darkModeSelector: '.dark &',
70
+ });
63
71
  const dir = path.resolve('dist/client/_astro');
64
72
  const BUILD_CSS = fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => f.endsWith('.css')).map((f) => fs.readFileSync(path.join(dir, f), 'utf8')).join('\n') : '';
65
73
 
@@ -74,7 +82,7 @@ export const onRequest = defineMiddleware(async (_ctx, next) => {
74
82
  });
75
83
  ```
76
84
 
77
- **Astro, static output:** do the same once in an integration's `astro:build:done` hook: read every `.css` under `dir` as the skip CSS, then rewrite every `.html`. The full recipe (shared config, static hook, client companion) is in the docs: `guide/integration/astro`.
85
+ **Astro, static output:** do the same once in an integration's `astro:build:done` hook: read every `.css` under `dir` as the skip CSS, then rewrite every `.html`, with the same `cssVarPrefix: 'tw'` and `darkModeSelector` on the `ServerRuntime`. The full recipe (shared config, static hook, client companion) is in the docs: `guide/integration/astro`.
78
86
 
79
87
  **Config to copy from the build CSS** (use the same object on server and client):
80
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barocss/server",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/barocss/barocss.git",
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "jsdom": "^26.1.0",
29
- "@barocss/kit": "0.7.0"
29
+ "@barocss/kit": "0.8.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "vite": "^7.1.3",
33
33
  "vite-plugin-dts": "^4.5.4",
34
- "vitest": "^3.2.4"
34
+ "vitest": "^5.0.2"
35
35
  },
36
36
  "scripts": {
37
37
  "build": "vite build",