UnoCSS in dev keeps the boot gate and hides the first paint

Open
#725 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, typescript

Research direction

Start with nexy/vite.py, especially the boot gate and fallback timeout logic around lines 50-60. Run the dev server against a project containing uno.config.ts and inspect the served document to determine whether UnoCSS can be exposed as a stylesheet or inlined without blocking first paint. Done means the served HTML contains no <style id="nexy-boot"> element, the e2e check records first paint with visible content, and plain CSS projects show no regression in FCP or CLS.

Written by the indexing model from the issue text.

Description

Problem

nexy/vite.py:58-60 keeps the boot gate whenever uno.config.ts exists, because UnoCSS
utilities only exist as a virtual module and there is no stylesheet link to block the first
paint. The gate is <style id="nexy-boot">html{visibility:hidden}</style> with a 2500 ms
fallback timeout (nexy/vite.py:50-55). The page is therefore blank for a moment on a cold dev
load.

#715 removed the gate for projects whose CSS is a real file. UnoCSS projects are still behind it.

Change to make

Expose the generated UnoCSS as a real stylesheet link in dev, or inline its CSS in the served
document, so the gate can be removed for UnoCSS projects too. Measure when the gate is removed
before and after the change.

Out of scope

The UnoCSS production build and CSS hot reload, which already work.

Checks

An e2e test on a project with uno.config.ts finds no nexy-boot element in the served HTML and
records a first paint with content. FCP and CLS from #713 do not get worse on plain CSS projects.

Dominant language
Python
Stars
11
Forks
6
Avg merge
2h 14m
Merged PRs (30d)
265

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NexyPy/nexy

All issues in NexyPy/nexy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.