Skip to content

fix(unocss): extract utilities from class: directives - #247

Merged
edbfi merged 2 commits into
mainfrom
fix/unocss-config
Oct 11, 2026
Merged

edbfi merged 2 commits into
mainfrom
fix/unocss-config

Conversation

@edbfi

@edbfi edbfi commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Adds @unocss/extractor-svelte. Without it, a utility used only in a class: directive gets no CSS. Today each of obzorarr's 55 directive utilities also appears somewhere else, so nothing is missing yet; this keeps it that way.

Changes

  • Adds @unocss/extractor-svelte (66.10.5, dev) and extractors: [extractorSvelte()].
  • .agents/rules/svelte5-sveltekit-app.md is synced from agent-rules@1adb50b. It brings the Wind4 UnoCSS setup (agent-rules#47) and shutdown without a front (agent-rules#46).
  • The safelist stays.
    • It was investigated: without it, 40 of its 86 entries are still extracted from source, and the other 46 appear in no source file.
    • But src/lib/server/slides/sanitize.ts:54 allows class on every tag of custom-slide HTML, so stored slides may rely on safelisted utilities.
    • Which utilities custom slides support is a product decision, recorded in edbfi-ci.

Evidence

  • Built CSS, before vs. after. bun run build on origin/main and on this branch, then a set-diff of every rule in the client CSS.
    • Only the :root,:host theme variables are reordered; no rule or value changes.
  • Directive coverage. I scanned every class:<token> directive in src/ and checked that the built CSS has a rule for it. Before and after, every utility has a rule. The only tokens without one are saving and variant-dark, which are component classes, not utilities.
  • bun run check: 0 errors and 0 warnings.
  • Review. Codex (gpt-6-astra, high) reviewed this change together with the other four apps and agent-rules#47.
    • Its safelist finding is why obzorarr keeps its safelist: custom slides allow class on user HTML.
    • Its type-cast finding was fixed in the rule.

Not in this PR

  • Kit 3's transform_index_html_unsupported warning stays (edbfi-ci D24). SvelteKit never calls UnoCSS's transformIndexHtml hook, and app.html has no utilities, so nothing is lost.
  • Dev server: only the first page render after startup includes UnoCSS in the server-rendered styles. Later requests don't, so dev pages can paint unstyled until the client JS loads uno.css. This was measured in all five apps, and moving the import to the root layout didn't fix it. It's recorded in edbfi-ci as a separate investigation.

Owner actions

None.

edbfi added 2 commits October 11, 2026 17:51
Without @unocss/extractor-svelte, a utility used only in a class:
directive gets no CSS. Every directive utility here also appears
elsewhere today, so nothing is missing yet.

Signed-off-by: edbfi <326875205+edbfi@users.noreply.github.com>
Brings the Wind4 UnoCSS setup (agent-rules#47) and shutdown without a
front (agent-rules#46).

Signed-off-by: edbfi <326875205+edbfi@users.noreply.github.com>

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues found; nothing blocking.

Reviewed changes

Reviewed the full diff of the two commits (4 files).

  • uno.config.ts — adds extractors: [extractorSvelte()]. UnoCSS keeps its default extractor alongside custom ones, so this only adds class: directive extraction. The safelist and the ./src/**/*.{html,js,svelte,ts} pipeline are untouched.
  • package.json / bun.lock — adds @unocss/extractor-svelte pinned to 66.10.5, matching the other @unocss/* pins. The lock workspace block mirrors package.json.
  • .agents/rules/svelte5-sveltekit-app.md — managed rule copy synced from agent-rules@1adb50b (Wind4 setup, shutdown without a front). Not reviewed for content, per repo convention.

Not verified: I couldn't install dependencies or run bun run build in this sandbox, so the built-CSS before/after comparison rests on the PR description. The lock entry's integrity hash and empty dependency map also can't be checked offline.

Nitpick: @unocss/reset (package.json:41) has no import anywhere in the repo. It isn't introduced by this PR, so no change is needed here.

Pullfrog  | Fix it ➔ | View workflow run | Using claude-sonnet-5-5 | 𝕏

@edbfi

edbfi commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

Review nitpick (unused @unocss/reset, package.json:41): REJECTED for this PR. It predates this change and is out of scope here. It's recorded with the S25 follow-ups in edbfi-ci.

@edbfi
edbfi merged commit 0add388 into main Oct 11, 2026
10 checks passed
@edbfi
edbfi deleted the fix/unocss-config branch October 11, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant