Open mikeyarce opened 3 years ago
The Podcast Block in Jetpack is always loading the following stylesheets even if there is no Podcast block present or if it's being used.
http://localhost/wp-includes/js/mediaelement/wp-mediaelement.min.css?ver=5.8 http://localhost/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css?ver=4.2.16
If I'm not using the Podcast block, I don't need these styles being loaded.
They loaded.
Screenshots
What's happening is that here we're declaring the style for the block: https://github.com/Automattic/jetpack/blob/cf8864a43ec2e2e740d166992c5a74d9e9aaadf7/projects/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php#L54
This passes through wp_enqueue_registered_block_scripts_and_styles here which actually does a wp_enqueue_style for the styles passed, regardless if the block is being used or not: https://github.com/WordPress/WordPress/blob/60c39d780530ac8e8c29d3619e0fbc4a88ee9eb6/wp-includes/script-loader.php#L2398
wp_enqueue_registered_block_scripts_and_styles
wp_enqueue_style
This is also noted in this forums post with the user looking for a fix or how to prevent these from loading.
The Podcast Block in Jetpack is always loading the following stylesheets even if there is no Podcast block present or if it's being used.
Steps to reproduce the issue
What I expected
If I'm not using the Podcast block, I don't need these styles being loaded.
What happened instead
They loaded.
Screenshots
What is happening
What's happening is that here we're declaring the style for the block: https://github.com/Automattic/jetpack/blob/cf8864a43ec2e2e740d166992c5a74d9e9aaadf7/projects/plugins/jetpack/extensions/blocks/podcast-player/podcast-player.php#L54
This passes through
wp_enqueue_registered_block_scripts_and_styles
here which actually does awp_enqueue_style
for the styles passed, regardless if the block is being used or not: https://github.com/WordPress/WordPress/blob/60c39d780530ac8e8c29d3619e0fbc4a88ee9eb6/wp-includes/script-loader.php#L2398