This simple script will allow you to enqueue your child theme stylesheet into the Gutenberg editor so you can see your custom CSS while editing.
add_filter( ‘generate_editor_styles’, function( $editor_styles ) {
$editor_styles[] = ‘style.css’;
return $editor_styles;
} );
Note: In my child theme, the css file is named 'style.css'
. If you have a different name for your child theme, you’ll need to place that in the code above where it says "/style.css"
.
Love your videos. You could use “enqueue_block_editor_assets” instead:
add_action('enqueue_block_editor_assets', function () {
wp_enqueue_style('current-theme', get_stylesheet_uri());
});
You can also use it to add customizer css:
add_action('enqueue_block_editor_assets', function() {
wp_register_style('customizer-css', false);
wp_enqueue_style('customizer-css');
wp_add_inline_style('customizer-css', wp_get_custom_css());
});