Skip to content

Commit

Permalink
Rebase after #43886
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Sep 6, 2022
1 parent c0dc70a commit 960e024
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/style-engine/style-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ function wp_style_engine_get_styles( $block_styles, $options = array() ) {
* @param array<string> $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.
Expand Down Expand Up @@ -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 );
}

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

0 comments on commit 960e024

Please sign in to comment.