#61395 closed enhancement (fixed)
Enqueue block custom CSS only when block renders on the page.
Reported by: | isabel_brison | Owned by: | isabel_brison |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 6.6 |
Component: | Editor | Keywords: | gutenberg-merge has-patch |
Focuses: | css | Cc: |
Description
Currently, block-specific custom CSS defined in theme.json or the global styles UI gets enqueued whether the block is on the page or not.
Custom CSS logic needs to be updated to more closely follow that of other global styles, so that block custom CSS can be enqueued conditionally in the same way as block global styles currently are.
Some of the changes from https://github.com/WordPress/gutenberg/pull/62357 can be brought into core.
Change History (7)
This ticket was mentioned in PR #6750 on WordPress/wordpress-develop by @isabel_brison.
5 months ago
#1
- Keywords has-patch added
@isabel_brison commented on PR #6750:
4 months ago
#2
Thanks for reviewing, folks!
Can anyone reproduce this issue, or is it just my environment?
I could reproduce that locally; it was due to a missing check that made sure dequeuing customizer CSS only happened for block themes. I've replaced the check now so things should work exactly as they do in trunk.
@isabel_brison commented on PR #6750:
4 months ago
#3
I've just put up a PR to fix this in Gutenberg too: https://github.com/WordPress/gutenberg/pull/63331
@aaronrobertshaw commented on PR #6750:
4 months ago
#4
Thanks for the quick fix 🚀
I could replicate the issue and can confirm the latest tweak in https://github.com/WordPress/wordpress-develop/pull/6750/commits/56d544825335a7b4e24bbf8aff4279c6db8e15f7 fixes it.
#5
@
4 months ago
- Owner set to isabel_brison
- Resolution set to fixed
- Status changed from new to closed
In 58703:
@isabel_brison commented on PR #6750:
4 months ago
#6
Thanks for re-testing! Committed in r58703,
@noisysocks commented on PR #6750:
3 months ago
#7
Thanks for committing this early in the 6.7 cycle ❤️
Trac ticket: https://core.trac.wordpress.org/ticket/61395
Syncs changes from https://github.com/WordPress/gutenberg/pull/62357.