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

WordPress Trac noreply at wordpress.org
Tue Jan 24 11:49:58 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 scruffian):

 > @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.

 Absolutely, that would be a great improvement.

 > 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).

 This is the original issue:
 https://github.com/WordPress/gutenberg/pull/40260

 The CSS for block themes does need to be output more generally because
 it's not just used for button blocks, but all buttons that contain
 buttons. However that's not the case for classic themes, so we should be
 able to load the CSS conditionally based on the presence of a button
 block, as you suggested above.

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


More information about the wp-trac mailing list