Skip to content

Commit

Permalink
Performance: change default imploding to false (#39486)
Browse files Browse the repository at this point in the history
* Performance: change default imploding to false

* Add phpcs ignores and comment out the previous false declarations
  • Loading branch information
kraftbj authored Sep 23, 2024
1 parent 9bc7ce4 commit 5e2ab4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/remove-imploding-css
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 11 additions & 7 deletions projects/plugins/jetpack/class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand All @@ -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;
}

/**
Expand Down

0 comments on commit 5e2ab4c

Please sign in to comment.