• Resolved almcr

    (@almcr)


    testing gutenberg using gutenberg and classic editor plugin. I also activated the ‘editor blocks’ plugin and created a wrapper block with content. a block was created and displays the way it should, using both inline styling and canned CSS.

    if I de-activate the ‘editor blocks’ plugin, and again edit the post using gutenberg, now the block displays as a ‘classic’ gutenberg block, it has lost its status as a gutenberg block. this is not what I expected. I assume this is done because when the ‘editor blocks’ plugin is not active, then related CSS is not loaded for use by the theme. of course, this assumes that the related CSS is not in the theme’s CSS.

    the same happens when you de-activate gutenberg, gutenberg CSS that is loaded if gutenberg is active does not get loaded, and suddenly your theme does not have styling code set for all of the gutenberg classes that gutenberg generates when you create a post or page. theme styling that depends on gutenberg or plugins should be avoided. perhaps gutenber CSS styling code should be moved to the theme’s CSS file, and not depend on gutenberg or plugins to be active. this would also allow the theme user to alter the default CSS styles, without changing the styling for all theme’s on the site.

    Al

Viewing 1 replies (of 1 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    ww.wp.xz.cn Admin

    I assume this is done because when the ‘editor blocks’ plugin is not active, then related CSS is not loaded for use by the theme.

    Actually, this is because when you disable the plugin, then the block itself no longer has any definition. It’s just a chunk of random HTML in the middle of the post that Gutenberg cannot parse properly. So it reverts to the Classic Editor block because that’s what the Classic Editor block is for: random HTML that isn’t in the new format.

    Basically, it’s not just that the CSS is missing, but the PHP code that defines the block, the Javascript code to render the block, and yes, any CSS needed to style the thing.

    If you use a plugin to add blocks, then you will need to keep using that plugin to have those blocks.

    As for disabling the plugin itself, well, yes, the missing CSS is a problem if you disable it. It’s a self-solving problem though, because the Gutenberg plugin itself is temporary. It will be built into WordPress 5.0, so you’ll have the CSS right there in WordPress. Themes can override any individual CSS they want, of course, but the base-level of styling for the blocks will be present and baked in along with the editor itself.

Viewing 1 replies (of 1 total)

The topic ‘where’s my CSS?’ is closed to new replies.