stillwind 0.10.1 → 0.12.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 (87) hide show
  1. package/AGENTS_TEMPLATE.md +3 -2
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +2 -2
  4. package/dist/{class-object-BaK8uudd.d.ts → class-object-CXvJOi2z.d.ts} +2 -2
  5. package/dist/class-object-CzD1oMD_.js +6 -0
  6. package/dist/{class-object-DNcjzcfH.js.map → class-object-CzD1oMD_.js.map} +1 -1
  7. package/dist/class-string-CrQnTRvI.js +6 -0
  8. package/dist/{class-string-KnYInbiw.js.map → class-string-CrQnTRvI.js.map} +1 -1
  9. package/dist/{class-string-C5YFtXQn.d.ts → class-string-DQmH4PZX.d.ts} +2 -2
  10. package/dist/frameworks/alpine.d.ts +2 -2
  11. package/dist/frameworks/alpine.js +1 -1
  12. package/dist/frameworks/astro.d.ts +2 -2
  13. package/dist/frameworks/astro.js +1 -1
  14. package/dist/frameworks/lit.d.ts +2 -2
  15. package/dist/frameworks/lit.js +1 -1
  16. package/dist/frameworks/preact.d.ts +2 -2
  17. package/dist/frameworks/preact.js +1 -1
  18. package/dist/frameworks/qwik.d.ts +2 -2
  19. package/dist/frameworks/qwik.js +1 -1
  20. package/dist/frameworks/react.d.ts +1 -1
  21. package/dist/frameworks/react.js +1 -1
  22. package/dist/frameworks/solid.d.ts +2 -2
  23. package/dist/frameworks/solid.js +1 -1
  24. package/dist/frameworks/svelte.d.ts +2 -2
  25. package/dist/frameworks/svelte.js +1 -1
  26. package/dist/frameworks/vanilla.d.ts +2 -2
  27. package/dist/frameworks/vanilla.js +1 -1
  28. package/dist/frameworks/vue.d.ts +2 -2
  29. package/dist/frameworks/vue.js +1 -1
  30. package/dist/{index-DBpgaaD7.d.ts → index-uw1R9t_P.d.ts} +11 -11
  31. package/dist/macro/index.d.ts +1 -1
  32. package/dist/macro/index.js +1 -1
  33. package/dist/style-Bzuux32Y.js +47 -0
  34. package/dist/{style-BE8vuLiO.js.map → style-Bzuux32Y.js.map} +1 -1
  35. package/docs/agents.md +1 -0
  36. package/docs/at-rules/apply.md +1 -1
  37. package/docs/at-rules/custom-variant.md +1 -1
  38. package/docs/at-rules/slot.md +1 -1
  39. package/docs/at-rules/stillwind-property.md +1 -1
  40. package/docs/at-rules/stillwind-registry.md +1 -1
  41. package/docs/at-rules/stillwind-require-properties.md +1 -1
  42. package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
  43. package/docs/at-rules/stillwind-undef-utility.md +1 -1
  44. package/docs/at-rules/stillwind-undef-variant.md +1 -1
  45. package/docs/at-rules/theme.md +5 -5
  46. package/docs/at-rules/utility.md +4 -4
  47. package/docs/at-rules/variant.md +1 -1
  48. package/docs/cli.md +146 -51
  49. package/docs/configuration.md +63 -4
  50. package/docs/errors/SW01001.md +1 -1
  51. package/docs/errors/SW03001.md +1 -1
  52. package/docs/errors/SW10004.md +1 -1
  53. package/docs/errors/SW10005.md +1 -1
  54. package/docs/errors/SW11001.md +1 -1
  55. package/docs/errors/SW12001.md +1 -1
  56. package/docs/errors/SW12002.md +1 -1
  57. package/docs/errors/SW13002.md +1 -1
  58. package/docs/errors/SW14001.md +1 -1
  59. package/docs/errors/SW14002.md +1 -1
  60. package/docs/errors/SW14003.md +1 -1
  61. package/docs/errors/SW14004.md +1 -1
  62. package/docs/errors/SW14007.md +1 -1
  63. package/docs/errors/SW32003.md +1 -1
  64. package/docs/errors/SW32005.md +1 -1
  65. package/docs/formatters.md +34 -2
  66. package/docs/guides/lint-adoption.md +2 -0
  67. package/docs/guides/migrating-from-tailwind.md +8 -0
  68. package/docs/guides/recommended-practices.md +18 -0
  69. package/docs/guides/tailwind-compatibility.md +8 -0
  70. package/docs/index.md +4 -5
  71. package/docs/integrations.md +295 -79
  72. package/docs/lints/index.md +12 -0
  73. package/docs/lints/invalid-cva-input.md +1 -1
  74. package/docs/lints/invalid-rule-group-input.md +1 -1
  75. package/docs/lints/missing-view-transition-name.md +1 -1
  76. package/docs/lints/prefer-direct-styling.md +1 -1
  77. package/docs/lints/suspending-macro-argument.md +1 -1
  78. package/docs/llms.txt +233 -0
  79. package/docs/macros/style.md +10 -0
  80. package/docs/plugins/iconify.md +2 -0
  81. package/docs/utilities-and-variants.md +2 -0
  82. package/package.json +4 -4
  83. package/skills/setup-stillwind/SKILL.md +1 -2
  84. package/skills/stillwind/SKILL.md +18 -11
  85. package/dist/class-object-DNcjzcfH.js +0 -6
  86. package/dist/class-string-KnYInbiw.js +0 -6
  87. package/dist/style-BE8vuLiO.js +0 -44
@@ -19,7 +19,7 @@ loader.provide(0, "root.css", ".card { color: red; }");
19
19
  loader.provide(0, "root.css", ".card { color: blue; }");
20
20
  ```
21
21
 
22
- > SW32005: provide called after completion
22
+ > SW32005: provide called after completion (in root.css)
23
23
 
24
24
  ## Fixed
25
25
 
@@ -5,6 +5,8 @@ description: "Sort utilities together with Prettier, Oxfmt, or another document
5
5
 
6
6
  # Formatters
7
7
 
8
+ > Command examples use `vp` (Vite+); substitute your project's package manager (such as `pnpm`, `npm`, or `bun`).
9
+
8
10
  Stillwind sorts utilities, and a document formatter controls layout and whitespace.
9
11
  How you combine them depends on the formatter:
10
12
 
@@ -69,8 +71,38 @@ The plugin only sorts. To replace utilities with their canonical spellings, run
69
71
 
70
72
  ## Other formatters
71
73
 
72
- Run `stillwind fmt` first. It sorts utilities and keeps the source layout, and the
73
- formatter then controls whitespace:
74
+ To format in one pass with `stillwind fmt` and `stillwind check`, configure a
75
+ project [`hooks`](https://stillwind.dev/docs/configuration#hooks) entry that transforms each buffer in
76
+ memory after Stillwind sorts utilities:
77
+
78
+ ```ts title="stillwind.config.ts"
79
+ import { format as oxfmt } from "oxfmt";
80
+ import { defineConfig, defineHook } from "stillwind/config";
81
+
82
+ export default defineConfig({
83
+ projects: [
84
+ {
85
+ css: "./src/stillwind.css",
86
+ files: ["src/**/*.{ts,tsx,vue,svelte,astro}"],
87
+ hooks: [
88
+ defineHook({
89
+ name: "oxfmt",
90
+ async format(file) {
91
+ const result = await oxfmt(file.path, file.code);
92
+ if (result.errors.length) {
93
+ throw new Error(result.errors.map((error) => error.message).join("\n"));
94
+ }
95
+ return result.code;
96
+ },
97
+ }),
98
+ ],
99
+ },
100
+ ],
101
+ });
102
+ ```
103
+
104
+ Without a hook, run `stillwind fmt` first. It sorts utilities and keeps the
105
+ source layout, and the formatter then controls whitespace:
74
106
 
75
107
  ```sh
76
108
  vp exec stillwind fmt
@@ -5,6 +5,8 @@ description: "Catch misspelled utilities, conflicts, and project policy violatio
5
5
 
6
6
  # Checks in the editor and CI
7
7
 
8
+ > Command examples use `vp` (Vite+); substitute your project's package manager (such as `pnpm`, `npm`, or `bun`).
9
+
8
10
  You want to catch misspelled utilities, conflicting styles, and values outside
9
11
  your theme before you merge a change. Stillwind checks them with lint rules.
10
12
  The CLI, CI, the editor, and AI agents all use the same rules from
@@ -16,6 +16,14 @@ generates CSS only for the utilities in `style()` calls. A class in a plain
16
16
  `className` string, or in HTML from another source, gets no CSS after the
17
17
  migration. Move every utility that you want to keep into `style()`.
18
18
 
19
+ ## Contents
20
+
21
+ - [Replace the stylesheet and the build plugin](#replace-the-stylesheet-and-the-build-plugin)
22
+ - [Move classes into style()](#move-classes-into-style)
23
+ - [Replace class helpers](#replace-class-helpers)
24
+ - [Move configuration](#move-configuration)
25
+ - [Check the migrated code](#check-the-migrated-code)
26
+
19
27
  ## Replace the stylesheet and the build plugin
20
28
 
21
29
  In your stylesheet, replace `@import "tailwindcss"` with `@import "stillwind"`:
@@ -8,6 +8,24 @@ description: "Keep styles next to their elements, reuse them through components,
8
8
  This page collects the practices that keep a Stillwind project easy to change.
9
9
  It also lists the mistakes that silently produce no CSS. The examples use React.
10
10
 
11
+ ## Contents
12
+
13
+ - [Keep styles next to their elements](#keep-styles-next-to-their-elements)
14
+ - [Spread style() onto the element](#spread-style-onto-the-element)
15
+ - [Express states with attributes](#express-states-with-attributes)
16
+ - [Connect elements with refs](#connect-elements-with-refs)
17
+ - [Define animations in their components](#define-animations-in-their-components)
18
+ - [Declare refs and animations in the smallest scope](#declare-refs-and-animations-in-the-smallest-scope)
19
+ - [Express options with one of a fixed set of values](#express-options-with-one-of-a-fixed-set-of-values)
20
+ - [Group utilities by variant](#group-utilities-by-variant)
21
+ - [Keep values in the theme](#keep-values-in-the-theme)
22
+ - [Choose how to define themes](#choose-how-to-define-themes)
23
+ - [Use breakpoints from the theme in JavaScript](#use-breakpoints-from-the-theme-in-javascript)
24
+ - [Define utilities with @apply](#define-utilities-with-apply)
25
+ - [Avoid separate CSS](#avoid-separate-css)
26
+ - [Run the checks after each change](#run-the-checks-after-each-change)
27
+ - [Mistakes that produce no CSS](#mistakes-that-produce-no-css)
28
+
11
29
  ## Keep styles next to their elements
12
30
 
13
31
  Write the utilities in a [`style()`](https://stillwind.dev/docs/guides/style) call on the element that
@@ -14,6 +14,14 @@ For the usage of Tailwind features, see the
14
14
  [Tailwind CSS documentation](https://tailwindcss.com/docs). To check the CSS of a
15
15
  utility or variant, use [Built-in utilities and variants](https://stillwind.dev/docs/utilities-and-variants).
16
16
 
17
+ ## Contents
18
+
19
+ - [What works](#what-works)
20
+ - [How Stillwind checks compatibility](#how-stillwind-checks-compatibility)
21
+ - [Plugins and CSS packages](#plugins-and-css-packages)
22
+ - [What Stillwind adds](#what-stillwind-adds)
23
+ - [What Stillwind does not support](#what-stillwind-does-not-support)
24
+
17
25
  ## What works
18
26
 
19
27
  | Tailwind feature | Support |
package/docs/index.md CHANGED
@@ -5,6 +5,8 @@ description: "Add Stillwind to a Vite and React application, style a component,
5
5
 
6
6
  # Getting started
7
7
 
8
+ > Command examples use `vp` (Vite+); substitute your project's package manager (such as `pnpm`, `npm`, or `bun`).
9
+
8
10
  This guide adds Stillwind to a Vite application that uses React. At the end, a
9
11
  button uses Stillwind styles, and the CLI checks them. For another framework or
10
12
  build tool, follow the same steps and use the build setup from
@@ -62,13 +64,10 @@ export default defineConfig({
62
64
  `css` selects the stylesheet. `files` selects the files that the CLI and the
63
65
  editor check.
64
66
 
65
- > **Builds compile imports**
67
+ > **How files is used**
66
68
  >
67
69
  > The build compiles every module that your application imports, whether or not `files` matches it.
68
- > The CLI and the language server (LSP) use `files` to find source files, including files that the
69
- > application does not import. A Vite build also loads the files that `files` matches into the type
70
- > checker before it compiles the first module, so pages that the application loads through dynamic
71
- > imports share one checker project. The dev server does not read these files in advance.
70
+ > The CLI and the editor use `files` to discover source files to check.
72
71
 
73
72
  Add Stillwind to `vite.config.ts`:
74
73
 
@@ -10,25 +10,40 @@ and the Stillwind integration for its build tool. This page assumes that you hav
10
10
  created the stylesheet and `stillwind.config.ts` from [Getting started](https://stillwind.dev/docs).
11
11
  Each integration finds `stillwind.config.ts` in the application root.
12
12
 
13
+ ## Contents
14
+
15
+ - [Import style() for your framework](#import-style-for-your-framework)
16
+ - [Vite](#vite)
17
+ - [Next.js](#nextjs)
18
+ - [Astro](#astro)
19
+ - [Nuxt](#nuxt)
20
+ - [SvelteKit](#sveltekit)
21
+ - [webpack and Rspack](#webpack-and-rspack)
22
+ - [Rsbuild](#rsbuild)
23
+ - [Fresh 2](#fresh-2)
24
+ - [Gatsby](#gatsby)
25
+ - [Standalone Turbopack](#standalone-turbopack)
26
+ - [CSS delivery and advanced options](#css-delivery-and-advanced-options)
27
+
13
28
  ## Import style() for your framework
14
29
 
15
30
  Import `style` from the entrypoint of the framework that renders the element:
16
31
 
17
32
  | Framework | Import | Class prop |
18
33
  | ------------------ | ------------------- | ----------- |
19
- | Alpine | `stillwind/alpine` | `class` |
34
+ | React | `stillwind/react` | `className` |
35
+ | Vue | `stillwind/vue` | `class` |
36
+ | Svelte | `stillwind/svelte` | `class` |
20
37
  | Astro | `stillwind/astro` | `class` |
21
- | Lit | `stillwind/lit` | `class` |
38
+ | Solid | `stillwind/solid` | `class` |
22
39
  | Preact | `stillwind/preact` | `class` |
40
+ | Alpine | `stillwind/alpine` | `class` |
41
+ | Lit | `stillwind/lit` | `class` |
23
42
  | Qwik | `stillwind/qwik` | `class` |
24
- | React | `stillwind/react` | `className` |
25
- | Solid | `stillwind/solid` | `class` |
26
- | Svelte | `stillwind/svelte` | `class` |
27
43
  | Vanilla JavaScript | `stillwind/vanilla` | `class` |
28
- | Vue | `stillwind/vue` | `class` |
29
44
 
30
- Spread the result with your framework's syntax. In JSX, Svelte, and Astro, write
31
- `{...style("...")}`. In Vue templates, write `v-bind="style('...')"`:
45
+ Spread the result with your framework's syntax. In JSX (including Vue JSX), Svelte,
46
+ and Astro, write `{...style("...")}`. In Vue templates, write `v-bind="style('...')"`:
32
47
 
33
48
  ```vue
34
49
  <script setup lang="ts">
@@ -41,27 +56,51 @@ import { style } from "stillwind/vue";
41
56
  ```
42
57
 
43
58
  A component uses the entrypoint of its own framework. For example, a React
44
- island inside an Astro page imports `stillwind/react`.
59
+ island inside an Astro page imports `stillwind/react`, Gatsby uses
60
+ `stillwind/react`, and Fresh 2 uses `stillwind/preact`.
45
61
 
46
- Alpine uses the `stillwind` plugin from `stillwind/alpine`. Register it with
47
- `Alpine.plugin(stillwind)` before `Alpine.start()`, then bind compiled props with
48
- `x-sw="props"`. Write macro calls in JavaScript or TypeScript modules.
62
+ ### Alpine
49
63
 
50
- Lit uses `html` element bindings such as
51
- `` html`<button ${applyStyle(style("px-4 py-2"))}>Save</button>` ``.
52
- Import both helpers from `stillwind/lit`. To add the styles to a shadow root,
53
- see [Web Components](https://stillwind.dev/docs/guides/web-components). The Lit directive supports
54
- browser rendering; Lit SSR is unsupported.
64
+ Register the `stillwind` plugin from `stillwind/alpine` before `Alpine.start()`,
65
+ and write `style()` calls in JavaScript or TypeScript modules rather than inline
66
+ HTML attributes:
55
67
 
56
- Gatsby uses `stillwind/react`, and Fresh 2 with Vite uses `stillwind/preact`.
57
- For Fresh, use Deno 2.9 or newer and register `fresh()` before `stillwind()` from
58
- `@stillwind/integration/fresh` in the Vite configuration. The adapter keeps server
59
- and island classes consistent. Fresh's legacy Builder is unsupported.
68
+ ```ts
69
+ import Alpine from "alpinejs";
70
+ import { stillwind, style } from "stillwind/alpine";
71
+
72
+ Alpine.plugin(stillwind);
73
+ Alpine.data("saveButton", () => ({
74
+ get buttonProps() {
75
+ return style("rounded-md bg-accent px-4 py-2 text-white");
76
+ },
77
+ }));
78
+ Alpine.start();
79
+ ```
80
+
81
+ Bind the compiled props in HTML with `x-sw`:
82
+
83
+ ```html
84
+ <div x-data="saveButton">
85
+ <button x-sw="buttonProps">Save changes</button>
86
+ </div>
87
+ ```
88
+
89
+ ### Lit
60
90
 
61
- On Linux, and possibly macOS, Fresh development and builds fail with `Bad file descriptor (os error 9)`
62
- when Stillwind starts the TypeScript checker under Deno.
91
+ Use `applyStyle` with `style` from `stillwind/lit` in `html` templates:
63
92
 
64
- ## Vanilla JavaScript
93
+ ```ts
94
+ import { html } from "lit";
95
+ import { applyStyle, style } from "stillwind/lit";
96
+
97
+ html`<button ${applyStyle(style("px-4 py-2"))}>Save</button>`;
98
+ ```
99
+
100
+ To add the compiled styles to a shadow root, see [Web Components](https://stillwind.dev/docs/guides/web-components).
101
+ The Lit directive supports browser rendering; Lit SSR is unsupported.
102
+
103
+ ### Vanilla JavaScript
65
104
 
66
105
  Import the DOM helpers with the macro:
67
106
 
@@ -82,10 +121,10 @@ elements and DOM elements. Each macro returns props for its own target.
82
121
 
83
122
  ## Vite
84
123
 
85
- Use the Vite plugin for Alpine, Lit, Preact, Qwik, React, Solid, Svelte, vanilla
86
- JavaScript, and Vue applications:
124
+ Use the Vite plugin for React, Vue, Svelte, Solid, Preact, Alpine, Lit, Qwik,
125
+ and vanilla JavaScript applications:
87
126
 
88
- ```ts
127
+ ```ts title="vite.config.ts"
89
128
  import { stillwind } from "@stillwind/integration/vite";
90
129
  import react from "@vitejs/plugin-react";
91
130
  import { defineConfig } from "vite";
@@ -98,24 +137,93 @@ export default defineConfig({
98
137
  Place `stillwind()` before the framework plugin, because Stillwind must compile
99
138
  styles before the framework compiles JSX or templates.
100
139
 
101
- Some plugins split routes or server functions before compilation, such as the
102
- TanStack Start plugin. Place those plugins before `stillwind()`:
103
- `[tanstackStart(), stillwind(), react()]`.
140
+ > **Do not import the Stillwind stylesheet**
141
+ >
142
+ > The Vite plugin reads the stylesheet that `css` selects in `stillwind.config.ts` and adds the
143
+ > compiled CSS to the page. Do not import that stylesheet anywhere else: not from JavaScript, not
144
+ > from another stylesheet, and not from framework options such as Starlight's `customCss`. If you
145
+ > import it, Vite also bundles it as plain CSS, and the page receives raw `@theme` and `@utility`
146
+ > rules. Stillwind warns when JavaScript or a framework option imports the stylesheet, but it cannot
147
+ > detect an `@import` in another stylesheet. This rule also applies to Astro, Nuxt, SvelteKit, Fresh
148
+ > 2, and other frameworks that run on Vite.
149
+
150
+ ### Vite SSR frameworks
151
+
152
+ Vite-based SSR frameworks such as React Router, TanStack Start, SolidStart, and
153
+ Qwik use `@stillwind/integration/vite`. Place plugins that split routes or
154
+ server functions before `stillwind()`, and place JSX or optimizer transforms
155
+ after `stillwind()`:
156
+
157
+ | Framework | Plugin order | Notes |
158
+ | -------------- | ----------------------------------------- | -------------------------------------------------- |
159
+ | React Router | `[stillwind(), reactRouter()]` | Add `?stillwind.css` for server-only modules |
160
+ | TanStack Start | `[tanstackStart(), stillwind(), react()]` | Add `?stillwind.css` for server-only modules |
161
+ | SolidStart | `[stillwind(), solidStart(), nitro()]` | Add the development SSR link in `entry-server.tsx` |
162
+ | Qwik | `[qwikCity(), stillwind(), qwikVite()]` | Uses Vite 7 (`@builder.io/qwik` 1) |
163
+
164
+ #### Development SSR stylesheet
165
+
166
+ During development, if a server-rendered page must render with styles before
167
+ client JavaScript runs (or without JavaScript, as in resumable Qwik pages), add
168
+ a stylesheet link to `/__stillwind/style.css?environment=ssr` in your document
169
+ `<head>` when `import.meta.env.DEV` is true:
170
+
171
+ ```tsx
172
+ {
173
+ import.meta.env.DEV && <link rel="stylesheet" href="/__stillwind/style.css?environment=ssr" />;
174
+ }
175
+ ```
176
+
177
+ The response includes every observed producer in the SSR environment and reloads
178
+ when styles or theme tokens change. You can limit the response to specific
179
+ root-relative files by repeating the `module` query parameter, for example
180
+ `/__stillwind/style.css?environment=ssr&module=src/routes/index.tsx`.
181
+
182
+ #### Server-only modules
183
+
184
+ When a framework removes a server-only dependency from the client bundle (such
185
+ as a React Router `*.server.ts` module or a TanStack Start server function
186
+ helper), import the module with `?stillwind.css` from the route that renders its
187
+ styles:
188
+
189
+ ```ts
190
+ import { serverProps } from "../server.server.js";
191
+ import "../server.server.js?stillwind.css";
192
+ ```
104
193
 
105
- The plugin reads the stylesheet that `css` selects in `stillwind.config.ts` and
106
- adds the compiled CSS to the page. Do not import that stylesheet anywhere else:
107
- not from JavaScript, not from another stylesheet, and not from framework options
108
- such as Starlight's `customCss`. If you import it, Vite also bundles it as plain
109
- CSS, and the page receives the raw `@theme` and `@utility` rules. Stillwind warns
110
- when JavaScript or a framework option imports the stylesheet. It cannot detect
111
- an `@import` in another stylesheet. This rule also applies to Astro, SvelteKit,
112
- Nuxt, and other frameworks that run on Vite.
194
+ The `?stillwind.css` import compiles the module's styles and dependencies
195
+ without evaluating or bundling the server JavaScript for the browser.
196
+
197
+ ## Next.js
198
+
199
+ Wrap your configuration in `next.config.mjs`:
200
+
201
+ ```js title="next.config.mjs"
202
+ import { withStillwind } from "@stillwind/integration/next";
203
+
204
+ export default withStillwind({});
205
+ ```
206
+
207
+ Pass your existing Next.js configuration as the first argument and optional
208
+ Stillwind overrides as the second argument. The wrapper works with both webpack
209
+ and Turbopack, and it keeps `"use client"` and `"use server"` directives.
210
+
211
+ The stylesheet includes the routes under `app/`, `pages/`, `src/app/`, and
212
+ `src/pages/`, and the modules that they import with static import paths. A
213
+ module that you import through a computed path, or a route written in MDX, gets
214
+ no styles.
215
+
216
+ > **Next.js loader options**
217
+ >
218
+ > Inline options passed to `withStillwind()` must be serializable; define naming callbacks in
219
+ > `stillwind.config.ts` instead. If Next.js runs from a directory other than the application root,
220
+ > set the `root` option.
113
221
 
114
222
  ## Astro
115
223
 
116
224
  Add the integration to `astro.config.ts`:
117
225
 
118
- ```ts
226
+ ```ts title="astro.config.ts"
119
227
  import { stillwind } from "@stillwind/integration/astro";
120
228
  import { defineConfig } from "astro/config";
121
229
 
@@ -144,13 +252,11 @@ before Stillwind's styles. Without an earlier layer order, Stillwind's base styl
144
252
  would override Starlight's content styles. Create a stylesheet that contains only
145
253
  the layer order, and make it the only entry in `customCss`:
146
254
 
147
- ```css
148
- /* src/styles/layers.css */
255
+ ```css title="src/styles/layers.css"
149
256
  @layer properties, base, starlight, theme, components, utilities;
150
257
  ```
151
258
 
152
- ```js
153
- // astro.config.mjs
259
+ ```js title="astro.config.mjs"
154
260
  import starlight from "@astrojs/starlight";
155
261
  import { stillwind } from "@stillwind/integration/astro";
156
262
  import { defineConfig } from "astro/config";
@@ -169,8 +275,7 @@ export default defineConfig({
169
275
  Put the Stillwind stylesheet in a separate file, select it with `css` in
170
276
  `stillwind.config.ts`, and keep it out of `customCss`:
171
277
 
172
- ```css
173
- /* src/styles/stillwind.css */
278
+ ```css title="src/styles/stillwind.css"
174
279
  @import "@astrojs/starlight-tailwind";
175
280
  @import "stillwind/theme.css" layer(theme);
176
281
  @import "stillwind/utilities.css" layer(utilities);
@@ -182,31 +287,25 @@ Put the Stillwind stylesheet in a separate file, select it with `css` in
182
287
  Starlight's colors and fonts. The stylesheet leaves out `stillwind/preflight.css`,
183
288
  because Starlight resets the page styles itself.
184
289
 
185
- ## Next.js
290
+ ## Nuxt
186
291
 
187
- Wrap your configuration in `next.config.mjs`:
292
+ Add the module to `nuxt.config.ts`:
188
293
 
189
- ```js
190
- import { withStillwind } from "@stillwind/integration/next";
294
+ ```ts title="nuxt.config.ts"
295
+ import { stillwind } from "@stillwind/integration/nuxt";
191
296
 
192
- export default withStillwind({});
297
+ export default defineNuxtConfig({
298
+ modules: [stillwind()],
299
+ });
193
300
  ```
194
301
 
195
- Pass your existing configuration to `withStillwind()`. The wrapper works with
196
- both webpack and Turbopack, and it keeps `"use client"` and `"use server"`
197
- directives.
198
-
199
- The stylesheet includes the routes under `app/`, `pages/`, `src/app/`, and
200
- `src/pages/`, and the modules
201
- that they import with static import paths. A module that you import through a
202
- computed path, or a route written in MDX, gets no styles. If Next.js runs from a
203
- directory other than the application root, set the `root` option.
302
+ The module sets up Vite and server rendering. Do not add the Vite plugin as well.
204
303
 
205
304
  ## SvelteKit
206
305
 
207
306
  Add the Vite plugin before `sveltekit()`:
208
307
 
209
- ```ts
308
+ ```ts title="vite.config.ts"
210
309
  import { stillwind } from "@stillwind/integration/vite";
211
310
  import { sveltekit } from "@sveltejs/kit/vite";
212
311
  import { defineConfig } from "vite";
@@ -219,39 +318,156 @@ export default defineConfig({
219
318
  In development, add the server hook so that server-rendered pages include their
220
319
  styles before JavaScript runs. Create `src/hooks.server.ts`:
221
320
 
222
- ```ts
321
+ ```ts title="src/hooks.server.ts"
223
322
  export { handle } from "@stillwind/integration/sveltekit/handle";
224
323
  ```
225
324
 
226
325
  If you already have a `handle`, combine both with `sequence()` from
227
326
  `@sveltejs/kit/hooks`.
228
327
 
229
- ## Nuxt
328
+ ## webpack and Rspack
230
329
 
231
- Add the module to `nuxt.config.ts`:
330
+ Register `StillwindPlugin` and keep a CSS pipeline in your bundler configuration.
232
331
 
233
- ```ts
234
- import { stillwind } from "@stillwind/integration/nuxt";
332
+ For Rspack:
235
333
 
236
- export default defineNuxtConfig({
237
- modules: [stillwind()],
334
+ ```js title="rspack.config.mjs"
335
+ import { StillwindPlugin } from "@stillwind/integration/rspack";
336
+
337
+ export default {
338
+ experiments: {
339
+ css: true,
340
+ },
341
+ plugins: [new StillwindPlugin()],
342
+ module: {
343
+ rules: [{ test: /\.css$/, type: "css" }],
344
+ },
345
+ };
346
+ ```
347
+
348
+ For webpack, import `StillwindPlugin` from `@stillwind/integration/webpack` and
349
+ keep either `experiments: { css: true }` with `{ test: /\.css$/, type: "css" }`
350
+ or your existing `css-loader` pipeline.
351
+
352
+ When using Vue with webpack, place `StillwindPlugin` before `VueLoaderPlugin`.
353
+ Vue's plugin clones loader rules during setup, so Stillwind's rules must already
354
+ be registered.
355
+
356
+ ## Rsbuild
357
+
358
+ Register `pluginStillwind()` alongside your framework plugin in `rsbuild.config.ts`:
359
+
360
+ ```ts title="rsbuild.config.ts"
361
+ import { defineConfig } from "@rsbuild/core";
362
+ import { pluginReact } from "@rsbuild/plugin-react";
363
+ import { pluginStillwind } from "@stillwind/integration/rsbuild";
364
+
365
+ export default defineConfig({
366
+ plugins: [pluginStillwind(), pluginReact()],
238
367
  });
239
368
  ```
240
369
 
241
- The module sets up Vite and server rendering. Do not add the Vite plugin as well.
370
+ Keep your framework plugin (such as `pluginReact()` or `pluginVue()`). Stillwind
371
+ runs after framework pre-loaders split routes and server functions and before
372
+ SWC lowers JSX. You can retain a server-only module's styles with
373
+ `import "./server-style.ts?stillwind.css"`.
374
+
375
+ ## Fresh 2
376
+
377
+ Use Deno 2.9 or newer. Register `fresh()` before `stillwind()` from
378
+ `@stillwind/integration/fresh` in `vite.config.ts`:
379
+
380
+ ```ts title="vite.config.ts"
381
+ import { fresh } from "@fresh/plugin-vite";
382
+ import { stillwind } from "@stillwind/integration/fresh";
383
+ import { defineConfig } from "vite";
384
+
385
+ export default defineConfig({
386
+ plugins: [fresh(), stillwind()],
387
+ });
388
+ ```
389
+
390
+ Import macros from `stillwind/preact`. The adapter keeps server and island class
391
+ names consistent. Fresh's legacy Builder is unsupported.
392
+
393
+ For development HTML without JavaScript, add
394
+ `/__stillwind/style.css?environment=ssr` to the `<head>` of `routes/_app.tsx`
395
+ when `import.meta.env.DEV` is true. Production builds use Fresh's stylesheet
396
+ manifest.
397
+
398
+ > **Known issue on Linux and macOS (Deno / Fresh)**
399
+ >
400
+ > On Linux, and possibly macOS, Fresh development and builds can fail with `Bad file descriptor (os
401
+ > error 9)` when Stillwind starts the TypeScript checker under Deno.
402
+
403
+ ## Gatsby
404
+
405
+ Use `stillwind/react` and register the webpack plugin in `gatsby-node.mjs` for
406
+ every webpack stage:
407
+
408
+ ```js title="gatsby-node.mjs"
409
+ import { StillwindPlugin } from "@stillwind/integration/webpack";
410
+
411
+ export function onCreateWebpackConfig({ actions, stage }) {
412
+ actions.setWebpackConfig({ plugins: [new StillwindPlugin()] });
413
+ if (stage === "develop") {
414
+ actions.setWebpackConfig({
415
+ optimization: {
416
+ splitChunks: {
417
+ cacheGroups: {
418
+ framework: {
419
+ test: /[\\/]node_modules[\\/](react|react-dom|scheduler|prop-types)[\\/]/,
420
+ },
421
+ },
422
+ },
423
+ },
424
+ });
425
+ }
426
+ }
427
+ ```
428
+
429
+ Import the Stillwind CSS entrypoint from both `gatsby-browser.js` and
430
+ `gatsby-ssr.js`:
431
+
432
+ ```js title="gatsby-browser.js"
433
+ import "./src/stillwind.css";
434
+ ```
435
+
436
+ ```js title="gatsby-ssr.js"
437
+ import "./src/stillwind.css";
438
+ ```
439
+
440
+ > **Gatsby with pnpm**
441
+ >
442
+ > The `splitChunks` matcher in `stage === "develop"` matches pnpm's nested package paths so Gatsby
443
+ > emits the `framework.js` chunk referenced by its development HTML.
444
+
445
+ ## Standalone Turbopack
446
+
447
+ When configuring Turbopack outside Next.js, add `stillwindRules()` to your
448
+ host's Turbopack rules and list every application entry module:
449
+
450
+ ```ts
451
+ import { stillwindRules } from "@stillwind/integration/turbopack";
452
+
453
+ const rules = stillwindRules({
454
+ entries: ["./src/main.tsx", "./src/other-entry.tsx"],
455
+ });
456
+ ```
242
457
 
243
- ## Other build tools
458
+ Unlike `withStillwind()` for Next.js, this entrypoint does not discover routes
459
+ automatically, and it does not expand entry globs. Paths are resolved relative
460
+ to `root` (or the process working directory by default). The loader follows
461
+ statically named local JS/TS imports, including lazy imports, and inline options
462
+ must be serializable.
244
463
 
245
- | Build tool | Import | Registration |
246
- | ---------- | ---------------------------------- | ---------------------------------- |
247
- | webpack | `@stillwind/integration/webpack` | `plugins: [new StillwindPlugin()]` |
248
- | Rspack | `@stillwind/integration/rspack` | `plugins: [new StillwindPlugin()]` |
249
- | Rsbuild | `@stillwind/integration/rsbuild` | `plugins: [pluginStillwind()]` |
250
- | Turbopack | `@stillwind/integration/turbopack` | Add `stillwindRules({ entries })` |
464
+ ## CSS delivery and advanced options
251
465
 
252
- With webpack and Vue, place `StillwindPlugin` before `VueLoaderPlugin`. With
253
- standalone Turbopack, list every entry module of the application in `entries`.
466
+ Vite and its wrappers emit one stylesheet by default. Set `emission: "split"` to
467
+ emit reusable CSS partitions and a `stillwind-manifest.json` file; custom SSR
468
+ documents can select ordered stylesheet links with `stylesheetLinks` from
469
+ `stillwind/css`.
254
470
 
255
- The [build integration reference](https://github.com/SegaraRai/stillwind/blob/main/docs/integrations.md)
256
- describes every option.
471
+ For advanced options, browser target inheritance, and host-specific contracts,
472
+ see the [integration contract on GitHub](https://github.com/SegaraRai/stillwind/blob/main/docs/integrations.md).
257
473
  [How styles compile](https://stillwind.dev/docs/concepts/how-styles-compile) explains how the CSS reaches the page.
@@ -14,6 +14,18 @@ The **Default** column shows the severity in the `recommended` preset, which a
14
14
  project uses when it has no `lint` setting. Each rule page shows its severity in
15
15
  every preset.
16
16
 
17
+ ## Contents
18
+
19
+ - [Misspelled or invalid utilities](#misspelled-or-invalid-utilities)
20
+ - [Invalid arguments to Stillwind APIs](#invalid-arguments-to-stillwind-apis)
21
+ - [Arguments and imports](#arguments-and-imports)
22
+ - [Conflicting or duplicated styles](#conflicting-or-duplicated-styles)
23
+ - [Styles that do not apply as written](#styles-that-do-not-apply-as-written)
24
+ - [Stylesheet definitions](#stylesheet-definitions)
25
+ - [Project policies](#project-policies)
26
+ - [Preferred spelling](#preferred-spelling)
27
+ - [Suppression comments](#suppression-comments)
28
+
17
29
  ## Misspelled or invalid utilities
18
30
 
19
31
  A utility or variant that these rules report produces no CSS.
@@ -16,7 +16,7 @@ declare const active: boolean;
16
16
  style.cva(active && "bg-blue-500");
17
17
  ```
18
18
 
19
- > invalid-cva-input: style.cva() values require static utilities, arrays, CSS variants, or custom properties. Utility inputs cannot use && or ternary expressions
19
+ > invalid-cva-input: style.cva() values require static utilities, arrays, CSS variants, or custom properties; utility inputs cannot use `&&` or ternary expressions
20
20
  >
21
21
  > Example:2:11
22
22