Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't remove block library stylesheet from the editor #15007

Closed
rocketdevcorp opened this issue Apr 17, 2019 · 6 comments
Closed

Can't remove block library stylesheet from the editor #15007

rocketdevcorp opened this issue Apr 17, 2019 · 6 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@rocketdevcorp
Copy link

rocketdevcorp commented Apr 17, 2019

To reproduce

In #7776 others have said that they were able to remove 'wp-block-library-css' from the back end using similar code to this:

add_action( 'enqueue_block_editor_assets', 'popstar_modify_editor_styles', 10 );

function popstar_modify_editor_styles() {
 	wp_deregister_style( 'wp-block-library-css' );
	wp_register_style( 'wp-block-library-css', '' );
}

It's not working for me. I also tried adjusting the priority on the action.

I'm using WP 5.1.1 and the Gutenberg plugin 5.4.0.

@samikeijonen
Copy link
Contributor

@rocketdevcorp Are you using handle wp-block-library or wp-block-library-css?

This is the weird part. In I'm using WP 5.1.1 and the Gutenberg plugin 5.4.0. wp-block-library works for me.

But when I pulled latest code from master couple of days ago, it does not work anymore. I'm using the code mentioned in this comment.

@youknowriad youknowriad added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Apr 17, 2019
@rocketdevcorp
Copy link
Author

@samikeijonen I had already updated to Gutenberg plugin 5.5.0 before I saw your message, but I can say that now (WP 5.1.1 and GB 5.5.0), neither handle are working.

I posted this as a new bug report, instead of just adding to #7776, because what you had reported as working before no longer works. But I guess this issue is really more of a Feature Request. I concur that devs really do need to be able to remove this stylesheet, or else the WYSIWYG selling point of Gutenberg goes away.

@samikeijonen
Copy link
Contributor

I confirm that in plugin version 5.5.0 handles wp-block-library and wp-block-library-theme doesn't work anymore.

@justintadlock
Copy link
Contributor

Changing the hook to enqueue_block_assets works for me on 5.6.1. Not sure how far back that's compatible.

@samikeijonen
Copy link
Contributor

I'll confirm this works, thanks @justintadlock!

@rocketdevcorp I'm going to close this ticket now, but feel free to re-open if something is unclear.

@justintadlock
Copy link
Contributor

Side note: The enqueue_block_assets runs on both the front and back end. So, you may only want to de-register on this hook. Still use enqueue_block_editor_assets to register your editor-only styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

4 participants