Sorry, we don't support your browser.  Install a modern browser

Load only CF styles in block editor (without using full Gutenberg integration)#143

I would like to be able to load the CF stylesheet in the block editor without enabling the CF controls in the sidebar. We’re using Core Framework with GeneratePress and GenerateBlocks, so in our case element styles should be created/accessed through GenerateBlocks, while the typography and spacing systems are maintained in CF (it’s likely I’ll start using the color system too).

I know I can turn it off in my own editor preferences, but it’s confusing other site editors as well, and I’d rather not have to worry about it.

2 months ago

My current workaround is the following code snippet:

/**
 * Enqueue Core Framework CSS in the block editor.
 */
function cf_enqueue_css_in_editor()
{
    if (is_admin()) {
        wp_enqueue_style(
            "core-framework-editor",
            plugins_url() .
                "/core-framework/assets/public/css/core_framework.css"
        );
    }
}
add_action("enqueue_block_assets", "cf_enqueue_css_in_editor");

However, it seems GenerateBlocks may override the CF styles in the editor in cases where I’ve added a GB class without setting styles in an attempt to access CF styles (e.g. auto-generated text size classes) — though it works on the frontend. It does allow for variable usage, though!

a month ago