Skip to content

CSS styling breaks during hot reload (incremental builds) #130

@ichoosetoaccept

Description

@ichoosetoaccept

Description

CSS styling intermittently stops loading during hot reload in the dev server. The page renders without any styling (raw HTML structure visible). Restarting bengal serve fixes the issue.

Repro steps

  1. Start dev server: uv run bengal serve
  2. Make changes to content files (e.g., edit markdown)
  3. After an incremental rebuild, CSS stops loading
  4. Browser shows unstyled page (no CSS applied)
  5. Kill and restart bengal serve - styling works again

Expected

CSS should remain loaded and functional throughout all incremental rebuilds.

Actual

After some incremental rebuilds, CSS stops being served/loaded. The page renders but without any styling.

Environment

  • Bengal version: 0.1.8
  • Python version: 3.14
  • OS: macOS

Investigation notes

Looked at the codebase and found potential causes:

  1. Asset discovery skip logic (bengal/orchestration/content.py:580-599): During incremental builds when only content files change, asset discovery is skipped and cached asset data is used. This might cause CSS bundling to not be re-triggered.

  2. Output asset detection thresholds (bengal/orchestration/build/provenance_filter.py:235-249): The check len(list(output_assets_dir.iterdir())) < 3 may be too low to detect when CSS needs rebuilding.

  3. Theme asset check (bengal/orchestration/build/rendering.py:268-281): Uses arbitrary threshold < 5 files to determine if theme assets need processing.

Workaround

Restart bengal serve when styling breaks.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions