Skip to content

Commit

Permalink
Override global styles custom CSS properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed May 9, 2023
1 parent a987667 commit f95f040
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ function gutenberg_enqueue_global_styles_custom_css() {
}
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles_custom_css' );
add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_global_styles_custom_css' );

/**
* Function that enqueues the CSS Custom Properties coming from theme.json.
*
* @since 5.9.0
*/
function gutenberg_enqueue_global_styles_css_custom_properties() {
wp_register_style( 'global-styles-css-custom-properties', false );
wp_add_inline_style( 'global-styles-css-custom-properties', gutenberg_get_global_stylesheet( array( 'variables' ) ) );
wp_enqueue_style( 'global-styles-css-custom-properties' );
}
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_global_styles_css_custom_properties' );
add_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_global_styles_css_custom_properties' );

0 comments on commit f95f040

Please sign in to comment.