Skip to content

Commit

Permalink
Move optimizing to gutenberg_get_global_stylesheet
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Aug 5, 2022
1 parent eaba42c commit cf6f4e6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
9 changes: 1 addition & 8 deletions lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,7 @@ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets'
$stylesheet .= $this->get_preset_classes( $setting_nodes, $origins );
}

$processor = new WP_Style_Engine_Processor_Gutenberg();
$processor->add_css_string( $stylesheet );

return $processor->get_css(
array(
'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG,
)
);
return $stylesheet;
}

/**
Expand Down
10 changes: 9 additions & 1 deletion lib/compat/wordpress-6.1/get-global-styles-and-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,13 @@ function gutenberg_get_global_stylesheet( $types = array() ) {
// This cache doesn't need to be any longer, we only want to avoid spikes on high-traffic sites.
set_transient( $transient_name, $stylesheet, MINUTE_IN_SECONDS );
}
return $stylesheet;

$processor = new WP_Style_Engine_Processor_Gutenberg();
$processor->add_css_string( $stylesheet );

return $processor->get_css(
array(
'prettify' => defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG,
)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function get_declarations_string( $should_prettify = false, $indent_count
* @return string The sanitized property name.
*/
protected function sanitize_property( $property ) {
return sanitize_key( $property );
return trim( sanitize_key( $property ) );
}

/**
Expand Down

0 comments on commit cf6f4e6

Please sign in to comment.