gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Don't remove wp-edit-blocks styles when removing wp-block-library-theme

Open arpadkdweb opened this issue 6 years ago • 1 comments

Is your feature request related to a problem? Please describe. Instead of having to overwrite default block styles in the admin editor, we can remove the css by deregistering wp-block-library-theme, however, the styles to the editor interface have this as a dependency so they are also removed and the admin interface breaks.

Describe the solution you'd like Although we can deregister wp-block-library-theme and then re-register wp-edit-blocks as a style, we should be able to simply remove the blocks styles without removing the interface styles.

Describe alternatives you've considered I have considered simply overwriting the default styles, but it seems like removing them would be a cleaner solution.

My current code is

function enqueue_editor_assets() {
  wp_deregister_style( 'wp-block-library-theme' );
  wp_deregister_style( 'wp-edit-blocks' );
  wp_register_style(
    'wp-edit-blocks',
    '/wp-includes/css/dist/block-library/editor.css',
    array(
      'wp-components',
      'wp-editor',
      'wp-block-library',
    )
  };
  wp_enqueue_style( 'wp-edit-blocks' );
}
add_action( 'enqueue_block_editor_assets', 'Namespace\enqueue_editor_assets' );

arpadkdweb avatar Jan 16 '20 08:01 arpadkdweb

These dependencies are defined in Core right now. So it's better to raise this as a trac ticket. That said, I'm not certain that we should do this. If you're deregistering this style, it means you're providing an alternative. Why not just provide this alternative as wp-block-library-theme

youknowriad avatar Jan 16 '20 16:01 youknowriad