[wp-trac] [WordPress Trac] #56990: Render blocking CSS `classic-themes.css` unnecessarily enqueued

WordPress Trac noreply at wordpress.org
Mon Jan 23 15:18:31 UTC 2023


#56990: Render blocking CSS `classic-themes.css` unnecessarily enqueued
-------------------------------------+-------------------------------
 Reporter:  adamsilverstein          |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  6.1.2
Component:  Themes                   |     Version:  6.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  css, performance
-------------------------------------+-------------------------------

Comment (by adamsilverstein):

 > These style originally existed in the button block itself. They were
 moved to the block.json of the button block, which meant that they were no
 longer output for classic themes, hence the need for this additional CSS.
 I think it needs to be added to all classic themes when a button block is
 present in either the content or elsewhere on the page. I don't have any
 opinion about how the CSS is added.

 @scruffian Adding the styles "to all classic themes when a button block is
 present" would be fine - the problem I raised here is that the CSS is
 added even when ''there are no buttons used on the page''.

 > These style originally existed in the button block itself. They were
 moved to the block.json of the button block, which meant that they were no
 longer output for classic themes, hence the need for this additional CSS

 Do you have any more details about why this change was made (or a link to
 the issue)? In my mind it would make more sense for the styles for the
 buttons to live in the button block so they are only present when a button
 is used (I guess I'm missing something though).

 > I have tested with TwentyTen theme with (attached are the links to
 WebPageTests)
 Thanks for testing the performance impact @wpgurudev. I'm guessing the
 effect is very minor, my main concern here is this is now loaded on all
 classic themes, even when not required (no button block used). So although
 the per site impact is tiny, the cumulative impact is huge.


 > It seems those styles are indeed needed, that makes sense. However, the
 performance concern here is really the additional request.


 These styles are only needed if you use the button block, yet the styles
 are added unconditionally to all classic themes. The concern I have is
 about the additional (unnecessary) CSS added to all sites multiplied by
 the number of sites that use classic themes and have no buttons (ie. they
 don't need it).

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


More information about the wp-trac mailing list