0

I want to know how to include default Gutenberg CSS (the one I can see in the editor when no custom editor style is applied) on frontend. I want my the_content() to look 1:1 like in the editor (font, margins, paddings, everything).

I need it to actually know what I'm fighting when I'm trying to style whatever on that piece of...editor.

add_theme_support( 'wp-block-styles' ); is not the answer, so don't you bother.

I'm sorry for sounding arrogant, so far I've received so many irrelevant answers on that on various forums that I'm considering ditching WordPress altogether

0

You can't. There's no stylesheet that exists that can be loaded on the front-end to make it match the editor exactly.

Any such stylesheet would need to be created independently of the styles used in the actual editor, because the styles that are used in the editor are written to share scope with the default wp-admin/ styles, which wouldn't exist on the front-end. This is because the block editor is not inside an iframe, like TinyMCE.

Additionally, any such stylesheet would be useless with all existing themes, because it would not be possible to create a stylesheet that would reliably reproduce the editor styles when loaded alongside theme styles. So such a stylesheet would only be usable as a starting point for new themes. If one were created for that purpose, it would be of little use since themes would need to override those styles anyway, unless they were all going to look the same. So all it would do is complicate development.

  • Thank you for your answer and explanation and the facts, appreciate it, but I think that your thinking is a bit wrong. Development is complicated NOW. The editor has a ghost invisible default stylesheet one has to fight with (the rules are unclear and the Block Editor Handbook part on theming is laughable) while frontend just has the wp-block-styles that loads just bits'n'pieces for the "odd" blocks. A single unified stylesheet would help, because then I'd just have to overwrite things that are KNOWN to me. – polish bastard Nov 29 '19 at 12:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.