Skip to content

[hosting] gen-pages omits wheel modules' components/ from @source — widget CSS uncompiled; hand-sourcing needs a non-portable .venv path that breaks on Windows #258

Description

@antosubash

Summary

gen-pages emits an absolute @source for each wheel-installed module's
pages/, but not for its components/. Wheel modules ship widgets under
components/ (pagebuilder's SiteHeader, MediaObject, Hero, …) whose
Tailwind classes go uncompiled unless the host hand-adds a @source line —
and the only way to point at a wheel dir by hand is a .venv-relative path,
which is not portable across OSes.

Why it bites (Windows)

A host that hand-writes the POSIX layout:

@source "../../.venv/lib/python3.12/site-packages/pagebuilder/components";

matches nothing on Windows, whose venv is .venv/Lib/site-packages/...
(capital Lib, no python3.x/). Tailwind accepts the glob silently and drops
every widget class from the build: the site-header nav is display:none
(lg:flex never emitted), the hero collapses, two-column widgets stack, and
section background colours vanish. The failure is invisible — no error, just a
broken-looking site — and only on Windows.

(Found the hard way bringing up Global Canopy Atlas on Windows.)

Root cause

render_modules_css (framework/hosting/simple_module_hosting/assets.py) emits
@source for pages_dir only:

source_lines = [
    f'@source "{e.pages_dir.as_posix()}/**/*.{{ts,tsx}}";'
    for e in assets
    if e.pages_dir and not in_repo(e.pages_dir)
]

components/ is never discovered, so every app is left to hand-source it — and
hand-sourcing a wheel dir can't be written portably.

Fix

Have gen-pages emit an absolute @source for a wheel module's components/
too, exactly as it already does for pages/. Absolute as_posix() paths work
on POSIX and Windows alike, so no host ever hand-writes a .venv/... line
again. In-repo modules stay covered by the host's static modules/* glob.

PR attached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions