Archived topic
Custom Styles Not Showing In Gutenberg
3 replies · Started by Simon on February 12, 2019
Hey guys,
Just wanted to know if there is a way to get the custom styles I have in "additional css" to show up in the Gutenberg editor screen? like if I apply a class to text in a span, with a different color.
Also I have been using Gutenberg columns with a width of "1" sort of as a section, on the front end it shows up fine, but in the editor it only fills half the screen. It's really annoying but not essential to fix. not sure if thats a Gutenberg thing or a Generatepress thing.
Thanks in advance for your help.
Hey Simon,
If you're using a child theme, you can enqueue your own CSS to the editor itself. The only issue is you have to deal with CSS specificity.
For example, if you add an editor.css file in your child theme, you can then add this function to add it to the editor:
add_action( 'enqueue_block_editor_assets', function() {
wp_enqueue_style( 'my-block-editor-styles', get_stylesheet_directory_uri() . "/editor.css", false,'1.0', 'all' );
} );
Let me know if you need more info :)
Hey Tom,
Thanks so much for your help with this. I don't use a child theme, so I guess I'll just live with it for now. Maybe one day they will update it to work or something. :)
Cheers,
Simon
No problem! :)