[wp-trac] [WordPress Trac] #59673: Add viewStyle block.json property for frontend-only block styles
WordPress Trac
noreply at wordpress.org
Wed Jan 31 09:03:51 UTC 2024
#59673: Add viewStyle block.json property for frontend-only block styles
-----------------------------------------------------+---------------------
Reporter: gaambo | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: 6.5
Component: Editor | Version: 6.4
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs-dev-note | Focuses:
-----------------------------------------------------+---------------------
Comment (by gziolo):
> I didn't add any special handling for core blocks, since no core block
uses viewStyle obviously. But in the future that might be the case. So I
think the phpunit tests checking for the correct core styles to be loaded
in regard to should_load_separate_core_block_assets must be adapted. But
I'm not fully sure I understand those. Maybe someone can help me with
that.
That one is indeed a complex one. It isn't an issue at the moment, but I
expect that if we were to use `viewStyle` for core blocks we would have to
provide two versions of CSS. The bundled one that would get registered
separately and the regular one should work out of the box.
> At the moment there are no e2e/phpunit tests which check if
viewStyle/viewScript get only enqueued in the frontend. Should I add tests
for that?
It would be nice to add unit tests as follow up. I'm not entirely sure how
to approach it as we would need to print the HTML for a page using block
theme that renders a custom block that defines `viewStyle` and
`viewScript`. Something, that would be useful in general.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59673#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list