You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tools/inspector.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,32 @@ description: The inspector UI for UnoCSS (@unocss/inspector).
8
8
The inspector UI for UnoCSS: `@unocss/inspector`.
9
9
Ships with `unocss` and `@unocss/vite`.
10
10
11
-
## Usage
11
+
The inspector allows you to inspect the generated CSS rules and the applied classes for each file. It also provides a REPL to test your utilities based on your current configuration.
12
+
13
+
Built on top of [devframe](https://devfra.me/), the inspector can be hosted in several ways.
14
+
15
+
## Vite DevTools (recommended)
16
+
17
+
When [Vite DevTools](https://devtools.vite.dev/) (`@vitejs/devtools`) is installed, the inspector is mounted automatically as a **UnoCSS dock** inside it — no auth prompt, live updates included.
18
+
19
+
`vite build` with DevTools' static build also bakes a pre-computed snapshot of the inspector data into the export, so the analysis is viewable without a dev server.
20
+
21
+
## Standalone URL
12
22
13
23
Visit <ahref="http://localhost:5173/__unocss"target="_blank"rel="noreferrer">localhost:5173/\_\_unocss</a> in your Vite dev server to see the inspector.
14
24
15
-
The inspector allows you to inspect the generated CSS rules and the applied classes for each file. It also provided a REPL to test your utilities based on your current configuration.
25
+
On first use, enter the one-time 6-digit code printed in your dev server terminal to unlock it (the token is remembered per browser). When Vite DevTools is active, this URL redirects into the DevTools UI instead.
26
+
27
+
::: info
28
+
The standalone URL is a deprecated surface — the Vite DevTools dock is the recommended way to use the inspector going forward.
29
+
:::
30
+
31
+
## Other hosts
32
+
33
+
`@unocss/inspector/devframe` exports the inspector as a portable [devframe definition](https://devfra.me/), mountable by any devframe host:
34
+
35
+
-`createInspectorDevframe(ctx)` — bind the inspector to an existing UnoCSS plugin context.
36
+
-`createStandaloneInspectorDevframe(options)` — build a standalone context by scanning project files, for hosts without a bundler-integrated UnoCSS context (e.g. a Next.js app using `@unocss/postcss` via [`@devframes/next`](https://devfra.me/frameworks/next)).
0 commit comments