From 960e024e1b6c09978545dc150d81856b380740bc Mon Sep 17 00:00:00 2001 From: ramonjd Date: Tue, 6 Sep 2022 19:47:30 +1000 Subject: [PATCH] Rebase after #43886 --- packages/style-engine/style-engine.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/style-engine/style-engine.php b/packages/style-engine/style-engine.php index c4a404ce5f15f..a3bf551dfbf4e 100644 --- a/packages/style-engine/style-engine.php +++ b/packages/style-engine/style-engine.php @@ -84,6 +84,8 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) { * @param array $options array( * 'context' => (string|null) An identifier describing the origin of the style object, e.g., 'block-supports' or 'global-styles'. Default is 'block-supports'. * When set, the style engine will attempt to store the CSS rules. + * 'optimize' => (boolean) Whether to optimize the CSS output, e.g., combine rules. + * 'prettify' => (boolean) Whether to add new lines to output. * );. * * @return string A compiled CSS string. @@ -117,7 +119,7 @@ function wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = a return ''; } - return WP_Style_Engine::compile_stylesheet_from_css_rules( $css_rule_objects ); + return WP_Style_Engine::compile_stylesheet_from_css_rules( $css_rule_objects, $options ); } /** @@ -126,13 +128,17 @@ function wp_style_engine_get_stylesheet_from_css_rules( $css_rules, $options = a * @access public * * @param string $store_name A valid store name. + * @param array $options array( + * 'optimize' => (boolean) Whether to optimize the CSS output, e.g., combine rules. + * 'prettify' => (boolean) Whether to add new lines to output. + * );. * * @return string A compiled CSS string. */ -function wp_style_engine_get_stylesheet_from_context( $store_name ) { +function wp_style_engine_get_stylesheet_from_context( $store_name, $options = array() ) { if ( ! class_exists( 'WP_Style_Engine' ) || empty( $store_name ) ) { return ''; } - return WP_Style_Engine::compile_stylesheet_from_css_rules( WP_Style_Engine::get_store( $store_name )->get_all_rules() ); + return WP_Style_Engine::compile_stylesheet_from_css_rules( WP_Style_Engine::get_store( $store_name )->get_all_rules(), $options ); }