stillwind 0.11.0 → 0.13.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 (120) hide show
  1. package/AGENTS_TEMPLATE.md +3 -2
  2. package/CHANGELOG.md +80 -0
  3. package/README.md +3 -3
  4. package/css/builtin-utilities/tw-borders.css +59 -59
  5. package/css/builtin-utilities/tw-effects.css +53 -53
  6. package/css/builtin-utilities/tw-typography.css +13 -13
  7. package/dist/class-object-C87DR3v2.js +6 -0
  8. package/dist/class-object-C87DR3v2.js.map +1 -0
  9. package/dist/class-object-CR0QHoF9.d.ts +10 -0
  10. package/dist/{class-string-C5YFtXQn.d.ts → class-string-BlClX8JK.d.ts} +2 -2
  11. package/dist/class-string-CiNTVHYm.js +6 -0
  12. package/dist/{class-string-KnYInbiw.js.map → class-string-CiNTVHYm.js.map} +1 -1
  13. package/dist/{formats-Ctf2WFc-.js → formats-DP9B9SG6.js} +228 -113
  14. package/dist/formats-DP9B9SG6.js.map +1 -0
  15. package/dist/{formats-aeLCNAXl.d.ts → formats-NBNjMP5R.d.ts} +34 -12
  16. package/dist/frameworks/alpine.d.ts +5 -3
  17. package/dist/frameworks/alpine.js +3 -1
  18. package/dist/frameworks/alpine.js.map +1 -1
  19. package/dist/frameworks/astro.d.ts +3 -3
  20. package/dist/frameworks/astro.js +1 -1
  21. package/dist/frameworks/lit.d.ts +5 -3
  22. package/dist/frameworks/lit.js +3 -1
  23. package/dist/frameworks/lit.js.map +1 -1
  24. package/dist/frameworks/preact.d.ts +3 -3
  25. package/dist/frameworks/preact.js +1 -1
  26. package/dist/frameworks/qwik.d.ts +3 -3
  27. package/dist/frameworks/qwik.js +1 -1
  28. package/dist/frameworks/react.d.ts +2 -2
  29. package/dist/frameworks/react.js +1 -1
  30. package/dist/frameworks/solid.d.ts +3 -3
  31. package/dist/frameworks/solid.js +1 -1
  32. package/dist/frameworks/svelte.d.ts +3 -3
  33. package/dist/frameworks/svelte.js +1 -1
  34. package/dist/frameworks/vanilla.d.ts +5 -3
  35. package/dist/frameworks/vanilla.js +6 -1
  36. package/dist/frameworks/vanilla.js.map +1 -0
  37. package/dist/frameworks/vue.d.ts +3 -3
  38. package/dist/frameworks/vue.js +1 -1
  39. package/dist/{index-DBpgaaD7.d.ts → index-DpaDcczW.d.ts} +157 -57
  40. package/dist/macro/index.d.ts +2 -2
  41. package/dist/macro/index.js +1 -1
  42. package/dist/runtime/development.d.ts +16 -8
  43. package/dist/runtime/development.js +57 -21
  44. package/dist/runtime/development.js.map +1 -1
  45. package/dist/runtime/index.d.ts +2 -2
  46. package/dist/runtime/index.js +1 -1
  47. package/dist/style-dMBm8aX_.js +50 -0
  48. package/dist/style-dMBm8aX_.js.map +1 -0
  49. package/docs/agents.md +1 -0
  50. package/docs/at-rules/apply.md +1 -1
  51. package/docs/at-rules/custom-variant.md +1 -1
  52. package/docs/at-rules/slot.md +1 -1
  53. package/docs/at-rules/stillwind-property.md +1 -1
  54. package/docs/at-rules/stillwind-registry.md +7 -7
  55. package/docs/at-rules/stillwind-require-properties.md +1 -1
  56. package/docs/at-rules/stillwind-undef-arbitrary-property.md +1 -1
  57. package/docs/at-rules/stillwind-undef-utility.md +1 -1
  58. package/docs/at-rules/stillwind-undef-variant.md +1 -1
  59. package/docs/at-rules/theme.md +5 -5
  60. package/docs/at-rules/utility.md +43 -4
  61. package/docs/at-rules/variant.md +1 -1
  62. package/docs/cli.md +146 -51
  63. package/docs/concepts/css-ordering.md +46 -7
  64. package/docs/concepts/how-styles-compile.md +8 -8
  65. package/docs/configuration.md +63 -4
  66. package/docs/errors/SW01001.md +1 -1
  67. package/docs/errors/SW03001.md +1 -1
  68. package/docs/errors/SW10004.md +1 -1
  69. package/docs/errors/SW10005.md +1 -1
  70. package/docs/errors/SW10006.md +34 -0
  71. package/docs/errors/SW11001.md +1 -1
  72. package/docs/errors/SW12001.md +1 -1
  73. package/docs/errors/SW12002.md +1 -1
  74. package/docs/errors/SW13002.md +1 -1
  75. package/docs/errors/SW14001.md +1 -1
  76. package/docs/errors/SW14002.md +1 -1
  77. package/docs/errors/SW14003.md +1 -1
  78. package/docs/errors/SW14004.md +1 -1
  79. package/docs/errors/SW14007.md +1 -1
  80. package/docs/errors/SW32003.md +1 -1
  81. package/docs/errors/SW32005.md +1 -1
  82. package/docs/errors/index.md +1 -0
  83. package/docs/formatters.md +34 -2
  84. package/docs/guides/lint-adoption.md +2 -0
  85. package/docs/guides/migrating-from-tailwind.md +60 -9
  86. package/docs/guides/recommended-practices.md +18 -0
  87. package/docs/guides/reusable-styles.md +2 -2
  88. package/docs/guides/tailwind-compatibility.md +8 -0
  89. package/docs/index.md +4 -5
  90. package/docs/integrations.md +314 -79
  91. package/docs/lints/conflicting-utilities.md +9 -0
  92. package/docs/lints/cyclic-style-order.md +61 -0
  93. package/docs/lints/index.md +26 -10
  94. package/docs/lints/{invalid-cva-config.md → invalid-recipe-config.md} +8 -8
  95. package/docs/lints/{invalid-cva-input.md → invalid-recipe-input.md} +9 -9
  96. package/docs/lints/invalid-rule-group-input.md +1 -1
  97. package/docs/lints/missing-view-transition-name.md +1 -1
  98. package/docs/lints/multiple-style-forwards.md +59 -0
  99. package/docs/lints/partial-utility-override.md +77 -0
  100. package/docs/lints/prefer-direct-styling.md +1 -1
  101. package/docs/lints/suspending-macro-argument.md +1 -1
  102. package/docs/lints/utility-class-selector.md +72 -0
  103. package/docs/llms.txt +238 -0
  104. package/docs/macros/index.md +1 -1
  105. package/docs/macros/recipe.md +246 -0
  106. package/docs/macros/style.md +72 -0
  107. package/docs/macros/when.md +1 -1
  108. package/docs/plugins/iconify.md +2 -0
  109. package/docs/utilities-and-variants.md +2 -0
  110. package/package.json +6 -6
  111. package/skills/setup-stillwind/SKILL.md +1 -2
  112. package/skills/stillwind/SKILL.md +19 -12
  113. package/dist/class-object-BaK8uudd.d.ts +0 -9
  114. package/dist/class-object-DNcjzcfH.js +0 -6
  115. package/dist/class-object-DNcjzcfH.js.map +0 -1
  116. package/dist/class-string-KnYInbiw.js +0 -6
  117. package/dist/formats-Ctf2WFc-.js.map +0 -1
  118. package/dist/style-BE8vuLiO.js +0 -44
  119. package/dist/style-BE8vuLiO.js.map +0 -1
  120. package/docs/macros/cva.md +0 -155
@@ -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,68 @@ 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`.
61
+
62
+ ### Install the component converters
63
+
64
+ Stillwind reads Vue, Svelte, and Astro components through converter packages.
65
+ These packages are optional peer dependencies, so package managers do not
66
+ install them automatically. Install the packages for each component format that
67
+ the application uses:
68
+
69
+ | Format | Packages |
70
+ | ------ | -------------------------------------------------------------- |
71
+ | Vue | `@vue/compiler-dom`, `@vue/compiler-sfc`, `@vue/language-core` |
72
+ | Svelte | `svelte`, `svelte2tsx` |
73
+ | Astro | `@astrojs/astro2tsx` |
74
+
75
+ For example, a Svelte application installs `svelte2tsx` as a development
76
+ dependency. If a package is missing, the build fails with an error such as
77
+ `Cannot find package 'svelte2tsx'`.
78
+
79
+ ### Alpine
80
+
81
+ Register the `stillwind` plugin from `stillwind/alpine` before `Alpine.start()`,
82
+ and write `style()` calls in JavaScript or TypeScript modules rather than inline
83
+ HTML attributes:
84
+
85
+ ```ts
86
+ import Alpine from "alpinejs";
87
+ import { stillwind, style } from "stillwind/alpine";
88
+
89
+ Alpine.plugin(stillwind);
90
+ Alpine.data("saveButton", () => ({
91
+ get buttonProps() {
92
+ return style("rounded-md bg-accent px-4 py-2 text-white");
93
+ },
94
+ }));
95
+ Alpine.start();
96
+ ```
97
+
98
+ Bind the compiled props in HTML with `x-sw`:
99
+
100
+ ```html
101
+ <div x-data="saveButton">
102
+ <button x-sw="buttonProps">Save changes</button>
103
+ </div>
104
+ ```
105
+
106
+ ### Lit
45
107
 
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.
108
+ Use `applyStyle` with `style` from `stillwind/lit` in `html` templates:
49
109
 
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.
110
+ ```ts
111
+ import { html } from "lit";
112
+ import { applyStyle, style } from "stillwind/lit";
55
113
 
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.
114
+ html`<button ${applyStyle(style("px-4 py-2"))}>Save</button>`;
115
+ ```
60
116
 
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.
117
+ To add the compiled styles to a shadow root, see [Web Components](https://stillwind.dev/docs/guides/web-components).
118
+ The Lit directive supports browser rendering; Lit SSR is unsupported.
63
119
 
64
- ## Vanilla JavaScript
120
+ ### Vanilla JavaScript
65
121
 
66
122
  Import the DOM helpers with the macro:
67
123
 
@@ -82,10 +138,10 @@ elements and DOM elements. Each macro returns props for its own target.
82
138
 
83
139
  ## Vite
84
140
 
85
- Use the Vite plugin for Alpine, Lit, Preact, Qwik, React, Solid, Svelte, vanilla
86
- JavaScript, and Vue applications:
141
+ Use the Vite plugin for React, Vue, Svelte, Solid, Preact, Alpine, Lit, Qwik,
142
+ and vanilla JavaScript applications:
87
143
 
88
- ```ts
144
+ ```ts title="vite.config.ts"
89
145
  import { stillwind } from "@stillwind/integration/vite";
90
146
  import react from "@vitejs/plugin-react";
91
147
  import { defineConfig } from "vite";
@@ -98,24 +154,93 @@ export default defineConfig({
98
154
  Place `stillwind()` before the framework plugin, because Stillwind must compile
99
155
  styles before the framework compiles JSX or templates.
100
156
 
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()]`.
157
+ > **Do not import the Stillwind stylesheet**
158
+ >
159
+ > The Vite plugin reads the stylesheet that `css` selects in `stillwind.config.ts` and adds the
160
+ > compiled CSS to the page. Do not import that stylesheet anywhere else: not from JavaScript, not
161
+ > from another stylesheet, and not from framework options such as Starlight's `customCss`. If you
162
+ > import it, Vite also bundles it as plain CSS, and the page receives raw `@theme` and `@utility`
163
+ > rules. Stillwind warns when JavaScript or a framework option imports the stylesheet, but it cannot
164
+ > detect an `@import` in another stylesheet. This rule also applies to Astro, Nuxt, SvelteKit, Fresh
165
+ > 2, and other frameworks that run on Vite.
166
+
167
+ ### Vite SSR frameworks
168
+
169
+ Vite-based SSR frameworks such as React Router, TanStack Start, SolidStart, and
170
+ Qwik use `@stillwind/integration/vite`. Place plugins that split routes or
171
+ server functions before `stillwind()`, and place JSX or optimizer transforms
172
+ after `stillwind()`:
173
+
174
+ | Framework | Plugin order | Notes |
175
+ | -------------- | ----------------------------------------- | -------------------------------------------------- |
176
+ | React Router | `[stillwind(), reactRouter()]` | Add `?stillwind.css` for server-only modules |
177
+ | TanStack Start | `[tanstackStart(), stillwind(), react()]` | Add `?stillwind.css` for server-only modules |
178
+ | SolidStart | `[stillwind(), solidStart(), nitro()]` | Add the development SSR link in `entry-server.tsx` |
179
+ | Qwik | `[qwikCity(), stillwind(), qwikVite()]` | Uses Vite 7 (`@builder.io/qwik` 1) |
180
+
181
+ #### Development SSR stylesheet
182
+
183
+ During development, if a server-rendered page must render with styles before
184
+ client JavaScript runs (or without JavaScript, as in resumable Qwik pages), add
185
+ a stylesheet link to `/__stillwind/style.css?environment=ssr` in your document
186
+ `<head>` when `import.meta.env.DEV` is true:
187
+
188
+ ```tsx
189
+ {
190
+ import.meta.env.DEV && <link rel="stylesheet" href="/__stillwind/style.css?environment=ssr" />;
191
+ }
192
+ ```
193
+
194
+ The response includes every observed producer in the SSR environment and reloads
195
+ when styles or theme tokens change. You can limit the response to specific
196
+ root-relative files by repeating the `module` query parameter, for example
197
+ `/__stillwind/style.css?environment=ssr&module=src/routes/index.tsx`.
198
+
199
+ #### Server-only modules
200
+
201
+ When a framework removes a server-only dependency from the client bundle (such
202
+ as a React Router `*.server.ts` module or a TanStack Start server function
203
+ helper), import the module with `?stillwind.css` from the route that renders its
204
+ styles:
205
+
206
+ ```ts
207
+ import { serverProps } from "../server.server.js";
208
+ import "../server.server.js?stillwind.css";
209
+ ```
210
+
211
+ The `?stillwind.css` import compiles the module's styles and dependencies
212
+ without evaluating or bundling the server JavaScript for the browser.
213
+
214
+ ## Next.js
215
+
216
+ Wrap your configuration in `next.config.mjs`:
217
+
218
+ ```js title="next.config.mjs"
219
+ import { withStillwind } from "@stillwind/integration/next";
220
+
221
+ export default withStillwind({});
222
+ ```
104
223
 
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.
224
+ Pass your existing Next.js configuration as the first argument and optional
225
+ Stillwind overrides as the second argument. The wrapper works with both webpack
226
+ and Turbopack, and it keeps `"use client"` and `"use server"` directives.
227
+
228
+ The stylesheet includes the routes under `app/`, `pages/`, `src/app/`, and
229
+ `src/pages/`, and the modules that they import with static import paths. A
230
+ module that you import through a computed path, or a route written in MDX, gets
231
+ no styles.
232
+
233
+ > **Next.js loader options**
234
+ >
235
+ > Inline options passed to `withStillwind()` must be serializable; define naming callbacks in
236
+ > `stillwind.config.ts` instead. If Next.js runs from a directory other than the application root,
237
+ > set the `root` option.
113
238
 
114
239
  ## Astro
115
240
 
116
241
  Add the integration to `astro.config.ts`:
117
242
 
118
- ```ts
243
+ ```ts title="astro.config.ts"
119
244
  import { stillwind } from "@stillwind/integration/astro";
120
245
  import { defineConfig } from "astro/config";
121
246
 
@@ -144,13 +269,11 @@ before Stillwind's styles. Without an earlier layer order, Stillwind's base styl
144
269
  would override Starlight's content styles. Create a stylesheet that contains only
145
270
  the layer order, and make it the only entry in `customCss`:
146
271
 
147
- ```css
148
- /* src/styles/layers.css */
272
+ ```css title="src/styles/layers.css"
149
273
  @layer properties, base, starlight, theme, components, utilities;
150
274
  ```
151
275
 
152
- ```js
153
- // astro.config.mjs
276
+ ```js title="astro.config.mjs"
154
277
  import starlight from "@astrojs/starlight";
155
278
  import { stillwind } from "@stillwind/integration/astro";
156
279
  import { defineConfig } from "astro/config";
@@ -169,8 +292,7 @@ export default defineConfig({
169
292
  Put the Stillwind stylesheet in a separate file, select it with `css` in
170
293
  `stillwind.config.ts`, and keep it out of `customCss`:
171
294
 
172
- ```css
173
- /* src/styles/stillwind.css */
295
+ ```css title="src/styles/stillwind.css"
174
296
  @import "@astrojs/starlight-tailwind";
175
297
  @import "stillwind/theme.css" layer(theme);
176
298
  @import "stillwind/utilities.css" layer(utilities);
@@ -182,31 +304,25 @@ Put the Stillwind stylesheet in a separate file, select it with `css` in
182
304
  Starlight's colors and fonts. The stylesheet leaves out `stillwind/preflight.css`,
183
305
  because Starlight resets the page styles itself.
184
306
 
185
- ## Next.js
307
+ ## Nuxt
186
308
 
187
- Wrap your configuration in `next.config.mjs`:
309
+ Add the module to `nuxt.config.ts`:
188
310
 
189
- ```js
190
- import { withStillwind } from "@stillwind/integration/next";
311
+ ```ts title="nuxt.config.ts"
312
+ import { stillwind } from "@stillwind/integration/nuxt";
191
313
 
192
- export default withStillwind({});
314
+ export default defineNuxtConfig({
315
+ modules: [stillwind()],
316
+ });
193
317
  ```
194
318
 
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.
319
+ The module sets up Vite and server rendering. Do not add the Vite plugin as well.
204
320
 
205
321
  ## SvelteKit
206
322
 
207
323
  Add the Vite plugin before `sveltekit()`:
208
324
 
209
- ```ts
325
+ ```ts title="vite.config.ts"
210
326
  import { stillwind } from "@stillwind/integration/vite";
211
327
  import { sveltekit } from "@sveltejs/kit/vite";
212
328
  import { defineConfig } from "vite";
@@ -219,39 +335,158 @@ export default defineConfig({
219
335
  In development, add the server hook so that server-rendered pages include their
220
336
  styles before JavaScript runs. Create `src/hooks.server.ts`:
221
337
 
222
- ```ts
338
+ ```ts title="src/hooks.server.ts"
223
339
  export { handle } from "@stillwind/integration/sveltekit/handle";
224
340
  ```
225
341
 
226
342
  If you already have a `handle`, combine both with `sequence()` from
227
343
  `@sveltejs/kit/hooks`.
228
344
 
229
- ## Nuxt
345
+ ## webpack and Rspack
230
346
 
231
- Add the module to `nuxt.config.ts`:
347
+ Register `StillwindPlugin` and keep a CSS pipeline in your bundler configuration.
232
348
 
233
- ```ts
234
- import { stillwind } from "@stillwind/integration/nuxt";
349
+ For Rspack:
235
350
 
236
- export default defineNuxtConfig({
237
- modules: [stillwind()],
351
+ ```js title="rspack.config.mjs"
352
+ import { StillwindPlugin } from "@stillwind/integration/rspack";
353
+
354
+ export default {
355
+ experiments: {
356
+ css: true,
357
+ },
358
+ plugins: [new StillwindPlugin()],
359
+ module: {
360
+ rules: [{ test: /\.css$/, type: "css" }],
361
+ },
362
+ };
363
+ ```
364
+
365
+ For webpack, import `StillwindPlugin` from `@stillwind/integration/webpack` and
366
+ keep either `experiments: { css: true }` with `{ test: /\.css$/, type: "css" }`
367
+ or your existing `css-loader` pipeline.
368
+
369
+ When using Vue with webpack, place `StillwindPlugin` before `VueLoaderPlugin`.
370
+ Vue's plugin clones loader rules during setup, so Stillwind's rules must already
371
+ be registered.
372
+
373
+ ## Rsbuild
374
+
375
+ Register `pluginStillwind()` alongside your framework plugin in `rsbuild.config.ts`:
376
+
377
+ ```ts title="rsbuild.config.ts"
378
+ import { defineConfig } from "@rsbuild/core";
379
+ import { pluginReact } from "@rsbuild/plugin-react";
380
+ import { pluginStillwind } from "@stillwind/integration/rsbuild";
381
+
382
+ export default defineConfig({
383
+ plugins: [pluginStillwind(), pluginReact()],
238
384
  });
239
385
  ```
240
386
 
241
- The module sets up Vite and server rendering. Do not add the Vite plugin as well.
387
+ Keep your framework plugin (such as `pluginReact()` or `pluginVue()`). Stillwind
388
+ runs after framework pre-loaders split routes and server functions and before
389
+ SWC lowers JSX. You can retain a server-only module's styles with
390
+ `import "./server-style.ts?stillwind.css"`.
391
+
392
+ ## Fresh 2
393
+
394
+ Use Deno 2.9 or newer. Register `fresh()` before `stillwind()` from
395
+ `@stillwind/integration/fresh` in `vite.config.ts`:
396
+
397
+ ```ts title="vite.config.ts"
398
+ import { fresh } from "@fresh/plugin-vite";
399
+ import { stillwind } from "@stillwind/integration/fresh";
400
+ import { defineConfig } from "vite";
401
+
402
+ export default defineConfig({
403
+ plugins: [fresh(), stillwind()],
404
+ });
405
+ ```
406
+
407
+ Import macros from `stillwind/preact`. The adapter keeps server and island class
408
+ names consistent. Fresh's legacy Builder is unsupported.
409
+
410
+ For development HTML without JavaScript, add
411
+ `/__stillwind/style.css?environment=ssr` to the `<head>` of `routes/_app.tsx`
412
+ when `import.meta.env.DEV` is true. Production builds use Fresh's stylesheet
413
+ manifest.
414
+
415
+ > **Known issue on Linux and macOS (Deno / Fresh)**
416
+ >
417
+ > On Linux, and possibly macOS, Fresh development and builds can fail with `Bad file descriptor (os
418
+ > error 9)` when Stillwind starts the TypeScript checker under Deno.
419
+
420
+ ## Gatsby
421
+
422
+ Use `stillwind/react` and register the webpack plugin in `gatsby-node.mjs` for
423
+ every webpack stage:
424
+
425
+ ```js title="gatsby-node.mjs"
426
+ import { StillwindPlugin } from "@stillwind/integration/webpack";
427
+
428
+ export function onCreateWebpackConfig({ actions, stage }) {
429
+ actions.setWebpackConfig({
430
+ plugins: [new StillwindPlugin()],
431
+ });
432
+ if (stage === "develop") {
433
+ actions.setWebpackConfig({
434
+ optimization: {
435
+ splitChunks: {
436
+ cacheGroups: {
437
+ framework: {
438
+ test: /[\\/]node_modules[\\/](react|react-dom|scheduler|prop-types)[\\/]/,
439
+ },
440
+ },
441
+ },
442
+ },
443
+ });
444
+ }
445
+ }
446
+ ```
447
+
448
+ Import the Stillwind CSS entrypoint from both `gatsby-browser.js` and
449
+ `gatsby-ssr.js`:
450
+
451
+ ```js title="gatsby-browser.js"
452
+ import "./src/stillwind.css";
453
+ ```
454
+
455
+ ```js title="gatsby-ssr.js"
456
+ import "./src/stillwind.css";
457
+ ```
458
+
459
+ > **Gatsby with pnpm**
460
+ >
461
+ > The `splitChunks` matcher in `stage === "develop"` matches pnpm's nested package paths so Gatsby
462
+ > emits the `framework.js` chunk referenced by its development HTML.
463
+
464
+ ## Standalone Turbopack
465
+
466
+ When configuring Turbopack outside Next.js, add `stillwindRules()` to your
467
+ host's Turbopack rules and list every application entry module:
468
+
469
+ ```ts
470
+ import { stillwindRules } from "@stillwind/integration/turbopack";
471
+
472
+ const rules = stillwindRules({
473
+ entries: ["./src/main.tsx", "./src/other-entry.tsx"],
474
+ });
475
+ ```
242
476
 
243
- ## Other build tools
477
+ Unlike `withStillwind()` for Next.js, this entrypoint does not discover routes
478
+ automatically, and it does not expand entry globs. Paths are resolved relative
479
+ to `root` (or the process working directory by default). The loader follows
480
+ statically named local JS/TS imports, including lazy imports, and inline options
481
+ must be serializable.
244
482
 
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 })` |
483
+ ## CSS delivery and advanced options
251
484
 
252
- With webpack and Vue, place `StillwindPlugin` before `VueLoaderPlugin`. With
253
- standalone Turbopack, list every entry module of the application in `entries`.
485
+ Vite and its wrappers emit one stylesheet by default. Set `emission: "split"` to
486
+ emit reusable CSS partitions and a `stillwind-manifest.json` file; custom SSR
487
+ documents can select ordered stylesheet links with `stylesheetLinks` from
488
+ `stillwind/css`.
254
489
 
255
- The [build integration reference](https://github.com/SegaraRai/stillwind/blob/main/docs/integrations.md)
256
- describes every option.
490
+ For advanced options, browser target inheritance, and host-specific contracts,
491
+ see the [integration contract on GitHub](https://github.com/SegaraRai/stillwind/blob/main/docs/integrations.md).
257
492
  [How styles compile](https://stillwind.dev/docs/concepts/how-styles-compile) explains how the CSS reaches the page.
@@ -9,6 +9,15 @@ This rule reports two utilities that set the same CSS property under the same
9
9
  conditions. Only one of them takes effect. The order of the generated CSS decides
10
10
  which one, not the order in your code, so the code does not show the result.
11
11
 
12
+ The rule does not report a utility under a JavaScript condition that is written
13
+ after the other utility and under more conditions, as in
14
+ `style("p-2", wide && "p-4")`. Its CSS comes later, so it overrides the other
15
+ utility when the condition is true, as the code shows.
16
+ [partial-utility-override](https://stillwind.dev/docs/lints/partial-utility-override) checks such
17
+ overrides. When the utility under more conditions is written first, as in
18
+ `style(wide && "p-4", "p-2")`, the rule still reports the pair, because that
19
+ utility wins although `p-2` is written last.
20
+
12
21
  ## Reported
13
22
 
14
23
  ```tsx
@@ -0,0 +1,61 @@
1
+ ---
2
+ title: "cyclic-style-order"
3
+ description: "Reports files that import values from each other, so their CSS order cannot follow both."
4
+ ---
5
+
6
+ # cyclic-style-order
7
+
8
+ This rule reports a file whose CSS must come after another file's CSS, while
9
+ that file's CSS must also come after this file, directly or through other
10
+ files. A file must come after another file when it imports and uses a value,
11
+ such as a component or a base style, that the other file declares. See
12
+ [CSS ordering](https://stillwind.dev/docs/concepts/css-ordering#files-that-pass-styles-to-components).
13
+
14
+ When the order forms a cycle, Stillwind keeps one of the orders, and the build
15
+ continues. The utilities that a caller passes to a component can then lose to
16
+ the component's own utilities.
17
+
18
+ ## Reported
19
+
20
+ ```tsx title="card.tsx"
21
+ import { style } from "stillwind/react";
22
+ import { Button } from "./button";
23
+
24
+ export function Card(props: CardProps) {
25
+ return (
26
+ <div {...style("rounded p-4", style.forward(props))}>
27
+ <Button {...style("w-full")} />
28
+ </div>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ```tsx title="button.tsx"
34
+ import { style } from "stillwind/react";
35
+ import { Card } from "./card";
36
+
37
+ export function Button(props: ButtonProps) {
38
+ return <Card {...style("p-2", style.forward(props))} />;
39
+ }
40
+ ```
41
+
42
+ `card.tsx` imports `Button`, and `button.tsx` imports `Card`.
43
+
44
+ ## How to fix
45
+
46
+ - Move the shared parts to a file that neither file imports from, so that the
47
+ imports go in one direction.
48
+ - Or remove the import in one direction, for example by passing the component
49
+ as a prop or a slot.
50
+
51
+ ## Rule settings
52
+
53
+ | Preset | Severity |
54
+ | --- | --- |
55
+ | `recommended` | warn |
56
+ | `strict` | deny |
57
+ | `stylistic` | off |
58
+
59
+ [Configure lint](https://stillwind.dev/docs/configuration#lint) to change the severity or options.
60
+
61
+ The CLI and the editor report this rule only when they analyze the whole project.
@@ -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.
@@ -35,12 +47,12 @@ report never matches.
35
47
  | ------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | ------- |
36
48
  | [invalid-animation-option](https://stillwind.dev/docs/lints/invalid-animation-option) | A utility that is not an animation option, such as `p-4` | deny |
37
49
  | [invalid-css-input](https://stillwind.dev/docs/lints/invalid-css-input) | A [`style.css()`](https://stillwind.dev/docs/macros/css) argument that is not a static utility | deny |
38
- | [invalid-cva-config](https://stillwind.dev/docs/lints/invalid-cva-config) | An unknown or malformed field in a [`style.cva()`](https://stillwind.dev/docs/macros/cva) configuration | deny |
39
- | [invalid-cva-input](https://stillwind.dev/docs/lints/invalid-cva-input) | `&&` or a ternary inside a `style.cva()` value | deny |
40
50
  | [invalid-keyframes-definition](https://stillwind.dev/docs/lints/invalid-keyframes-definition) | A frame key that is not a keyframe position, such as `middle` | deny |
41
51
  | [invalid-keyframes-use](https://stillwind.dev/docs/lints/invalid-keyframes-use) | An animation applied with an argument that is not an options string | deny |
42
52
  | [invalid-keyframes-variant](https://stillwind.dev/docs/lints/invalid-keyframes-variant) | A selector or container variant around a keyframes definition | deny |
43
53
  | [invalid-media-query](https://stillwind.dev/docs/lints/invalid-media-query) | A condition in [`style.media()`](https://stillwind.dev/docs/macros/media) that is not a media query, such as `hover` | deny |
54
+ | [invalid-recipe-config](https://stillwind.dev/docs/lints/invalid-recipe-config) | An unknown or malformed field in a [`style.recipe()`](https://stillwind.dev/docs/macros/recipe) configuration | deny |
55
+ | [invalid-recipe-input](https://stillwind.dev/docs/lints/invalid-recipe-input) | `&&` or a ternary inside a `style.recipe()` value | deny |
44
56
  | [invalid-ref-input](https://stillwind.dev/docs/lints/invalid-ref-input) | A [`style.ref()`](https://stillwind.dev/docs/macros/ref) label or ref method argument that is not a literal | deny |
45
57
  | [invalid-rule-group-input](https://stillwind.dev/docs/lints/invalid-rule-group-input) | A `class` field or ref inside a variant key of [`style()`](https://stillwind.dev/docs/macros/style) | deny |
46
58
  | [invalid-runtime-condition](https://stillwind.dev/docs/lints/invalid-runtime-condition) | A runtime CSS condition that Stillwind cannot compile | deny |
@@ -63,14 +75,17 @@ report never matches.
63
75
 
64
76
  ## Conflicting or duplicated styles
65
77
 
66
- | Rule | Reports | Default |
67
- | ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- | ------- |
68
- | [ambiguous-style-base-order](https://stillwind.dev/docs/lints/ambiguous-style-base-order) | Two base styles in one call that set the same property | warn |
69
- | [conflicting-provider-properties](https://stillwind.dev/docs/lints/conflicting-provider-properties) | A container or anchor property that a ref method and a utility both set | warn |
70
- | [conflicting-utilities](https://stillwind.dev/docs/lints/conflicting-utilities) | Utilities that set the same property, such as `p-2 p-4` | warn |
71
- | [duplicate-utility](https://stillwind.dev/docs/lints/duplicate-utility) | The same utility twice under the same conditions | warn |
72
- | [interfering-imported-style-base](https://stillwind.dev/docs/lints/interfering-imported-style-base) | An imported base style that sets the same property as another style | warn |
73
- | [unverified-style-base](https://stillwind.dev/docs/lints/unverified-style-base) | A base style whose origin the CLI cannot determine from its type | warn |
78
+ | Rule | Reports | Default |
79
+ | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ------- |
80
+ | [ambiguous-style-base-order](https://stillwind.dev/docs/lints/ambiguous-style-base-order) | Two base styles in one call that set the same property | warn |
81
+ | [conflicting-provider-properties](https://stillwind.dev/docs/lints/conflicting-provider-properties) | A container or anchor property that a ref method and a utility both set | warn |
82
+ | [conflicting-utilities](https://stillwind.dev/docs/lints/conflicting-utilities) | Utilities that set the same property, such as `p-2 p-4` | warn |
83
+ | [cyclic-style-order](https://stillwind.dev/docs/lints/cyclic-style-order) | Files that pass styles to components of each other | warn |
84
+ | [duplicate-utility](https://stillwind.dev/docs/lints/duplicate-utility) | The same utility twice under the same conditions | warn |
85
+ | [interfering-imported-style-base](https://stillwind.dev/docs/lints/interfering-imported-style-base) | An imported base style that sets the same property as another style | warn |
86
+ | [multiple-style-forwards](https://stillwind.dev/docs/lints/multiple-style-forwards) | A `style()` call with more than one `style.forward()` argument | warn |
87
+ | [partial-utility-override](https://stillwind.dev/docs/lints/partial-utility-override) | An override that leaves properties of the overridden utility, such as the line height of `text-sm` | warn |
88
+ | [unverified-style-base](https://stillwind.dev/docs/lints/unverified-style-base) | A base style whose origin the CLI cannot determine from its type | warn |
74
89
 
75
90
  ## Styles that do not apply as written
76
91
 
@@ -87,6 +102,7 @@ report never matches.
87
102
  | [split-view-transition-class](https://stillwind.dev/docs/lints/split-view-transition-class) | View transitions split across separate [`style()`](https://stillwind.dev/docs/macros/style) calls | warn |
88
103
  | [unmatched-host-selector](https://stillwind.dev/docs/lints/unmatched-host-selector) | A variant that tests a shadow host through the elements around it | warn |
89
104
  | [unsatisfiable-variants](https://stillwind.dev/docs/lints/unsatisfiable-variants) | Variants that can never match together, such as `portrait:landscape:` | warn |
105
+ | [utility-class-selector](https://stillwind.dev/docs/lints/utility-class-selector) | A selector that tests the class attribute for a utility name, such as `[class*='size-']` | warn |
90
106
 
91
107
  ## Stylesheet definitions
92
108