feat(hosting): source wheel modules' components/ in gen-pages (fixes Windows widget-CSS drop) - #259
Open
antosubash wants to merge 1 commit into
Open
feat(hosting): source wheel modules' components/ in gen-pages (fixes Windows widget-CSS drop)#259antosubash wants to merge 1 commit into
antosubash wants to merge 1 commit into
Conversation
`render_modules_css` emitted an absolute `@source` for each wheel module's `pages/` but not its `components/`, so widgets shipped in a wheel (pagebuilder's SiteHeader, MediaObject, Hero, ...) had their Tailwind classes dropped from the build unless the host hand-added a `@source` line. Hand-sourcing a wheel dir can only be written as a `.venv`-relative path, which silently matches nothing on Windows (`.venv/Lib/site-packages`, not `.venv/lib/python3.x/...`) — the site builds with the widget nav at `display:none` and no error. Discover `components/` alongside `pages/` and emit the same absolute `as_posix()` `@source` glob. In-repo modules stay covered by the host's static `modules/*` glob. No host hand-writes a `.venv/...` line again. Closes #258 Claude-Session: https://claude.ai/code/session_01852vDTaepS9fbFaMEWrrVX
Deploying simple-module-python with
|
| Latest commit: |
0a0be3a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://248f9409.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-gen-pages-source-compone.simple-module-python.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gen-pagesemits an absolute@sourcefor each wheel-installed module'spages/, but not for itscomponents/. Wheel modules ship widgets undercomponents/(pagebuilder'sSiteHeader,MediaObject,Hero, …) whoseTailwind classes go uncompiled unless the host hand-adds a
@sourceline —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:
matches nothing on Windows, whose venv is
.venv/Lib/site-packages/...(capital
Lib, nopython3.x/). Tailwind accepts the glob silently and dropsevery widget class from the build: the site-header nav is
display:none(
lg:flexnever emitted), the hero collapses, two-column widgets stack, andsection 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@sourceforpages_dironly:components/is never discovered, so every app is left to hand-source it — andhand-sourcing a wheel dir can't be written portably.
Fix
Have
gen-pagesemit an absolute@sourcefor a wheel module'scomponents/too, exactly as it already does for
pages/. Absoluteas_posix()paths workon POSIX and Windows alike, so no host ever hand-writes a
.venv/...lineagain. In-repo modules stay covered by the host's static
modules/*glob.PR attached.
Change:
compute_module_assetsnow discoverscomponents/;render_modules_cssemits the same absoluteas_posix()@sourceglob for it as forpages/;modules.assets.jsongains acomponentskey. Added unit tests for detection + emission (+ the in-repo skip);16 passed, 1 skipped, ruff clean.Closes #258