[wp-trac] [WordPress Trac] #53494: Styles not applied to block using theme.json with seperate assets loading enabled

WordPress Trac noreply at wordpress.org
Fri Jun 25 12:43:35 UTC 2021


#53494: Styles not applied to block using theme.json with seperate assets loading
enabled
--------------------------+---------------------
 Reporter:  walbo         |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.8
Component:  Editor        |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+---------------------

Comment (by nosolosw):

 Hey, looked a bit at this issue and this is what I find:

 1. Classic themes:
   1. styles load in the {{{<head>}}} with
 `should_load_separate_core_block_assets` disabled
   2. styles load at the bottom of the {{{<body>}}} with
 `should_load_separate_core_block_assets` enabled
 2. FSE themes: styles always load in the head both with and without
 `should_load_separate_core_block_assets` enabled.

 The only case in which global styles loads after block styles is 1.2,
 which was [https://github.com/WordPress/gutenberg/issues/31293 brought up]
 in Gutenberg a few months ago and, apparently, was
 [https://github.com/WordPress/gutenberg/pull/31309#pullrequestreview-648289245
 no longer happening]. I wonder if something changed that introduced 1.2
 back?

 The options I see forward:

 - I'm a bit out of my expertise here, but wanted to share for others to
 weigh in: can we make it so that the `post_content` is pre-rendered for
 classic themes that have `should_load_separate_core_block_assets` enabled
 so we can enqueue the block styles in the {{{<head>}}}? This is: can we
 not have 1.2?

 - Alternatively, we can enqueue global styles in the "footer" in 1.2,
 following what block styles do. My concern with this approach is the same
 I shared
 [https://github.com/WordPress/gutenberg/pull/31309#issuecomment-829154451
 before]: that by changing the place block styles are enqueued to, we may
 run into other conflicts with plugins and theme styles. In other words,
 third parties need to be aware of this logic as well. If they want to
 override block & global styles they can only do it by enqueuing to the
 footer with higher priority than the default.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53494#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list