From 5e2ab4cd21a3ebd29e3043359c4acc6e6b06178a Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Mon, 23 Sep 2024 17:04:10 -0500 Subject: [PATCH] Performance: change default imploding to false (#39486) * Performance: change default imploding to false * Add phpcs ignores and comment out the previous false declarations --- .../jetpack/changelog/remove-imploding-css | 4 ++++ projects/plugins/jetpack/class.jetpack.php | 18 +++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/remove-imploding-css diff --git a/projects/plugins/jetpack/changelog/remove-imploding-css b/projects/plugins/jetpack/changelog/remove-imploding-css new file mode 100644 index 0000000000000..0a2041c43bce3 --- /dev/null +++ b/projects/plugins/jetpack/changelog/remove-imploding-css @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Performance: set the concatenated CSS to false by default. The era where this was helpful is passing. diff --git a/projects/plugins/jetpack/class.jetpack.php b/projects/plugins/jetpack/class.jetpack.php index f75b4baf918fb..1dfacebb27068 100644 --- a/projects/plugins/jetpack/class.jetpack.php +++ b/projects/plugins/jetpack/class.jetpack.php @@ -5688,16 +5688,19 @@ public static function absolutize_css_urls( $css, $css_file_url ) { * @param bool $travis_test Is this a test run. * * @since 3.2 + * @since $$next-version$$ Default to not imploding. Requires a filter to enable. This may be temporary before dropping completely. */ public function implode_frontend_css( $travis_test = false ) { - $do_implode = true; - if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { - $do_implode = false; + $do_implode = false; + if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf + // phpcs:ignore Squiz.PHP.CommentedOutCode.Found + // $do_implode = false; } // Do not implode CSS when the page loads via the AMP plugin. - if ( class_exists( Jetpack_AMP_Support::class ) && Jetpack_AMP_Support::is_amp_request() ) { - $do_implode = false; + if ( class_exists( Jetpack_AMP_Support::class ) && Jetpack_AMP_Support::is_amp_request() ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf + // phpcs:ignore Squiz.PHP.CommentedOutCode.Found + // $do_implode = false; } /* @@ -5708,8 +5711,9 @@ public function implode_frontend_css( $travis_test = false ) { $active_modules = self::get_active_modules(); $modules_with_concatenated_css = $this->modules_with_concatenated_css; $active_module_with_css_count = count( array_intersect( $active_modules, $modules_with_concatenated_css ) ); - if ( $active_module_with_css_count < 2 ) { - $do_implode = false; + if ( $active_module_with_css_count < 2 ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedIf + // phpcs:ignore Squiz.PHP.CommentedOutCode.Found + // $do_implode = false; } /**