fix(harness): load only the block CSS WordPress would, and gate undeclared stylesheets #129
No reviewers
Labels
No labels
priority
P1
priority
P2
priority
P3
priority
P4
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Toilville/toilville-design!129
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/harness-declared-styles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Merge after toilville_rituals #399. CI's Test Generator checks out Rituals
main, and the new gate fails until #399's declarations are there.What happened
Eight
toilville/*blocks shipped astyle.cssthat theirblock.jsonnever declared. WordPress only enqueues a block's stylesheet whenblock.jsonnames it, so after today's deploy the live Rituals, Spelwork, News and Contact pages rendered mostly unstyled. #399 fixed that, and it's already live from its branch.Nothing here caught it, because the preview harness loaded every
blocks/*/style.csson disk, with a comment saying "as WP does". That's the fourth way the harness has flattered production.The harness now loads what WordPress loads
build_page.pyreads eachblock.jsonand loads only the stylesheets it declares (style,viewStyle). It also expands each@importrelative to the stylesheet that imports it. Inlined into the page, an@importwould otherwise resolve against the page instead of the stylesheet.hero-productcard-gridb05bd3b)33a9358)@importleftThe first row matches what live WordPress served before the hotfix.
New gate
test_every_block_stylesheet_is_declaredchecks two things:.cssin a block directory is declared in itsblock.json(style,viewStyleoreditorStyle)_shared/*.cssis imported by a declared stylesheetIt is red against the pre-fix plugin:
It is green against #399.
Verified
Against #399's plugin:
just checkgreenpytest, run as CI runs it: 305 passed, 0 skipped