-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Dequeue theme.css #7776
Comments
Thanks for the cc! Hi @samikeijonen, it turns out that styles can be registered with an empty source, so you can use that instead of an empty file: add_action( 'enqueue_block_editor_assets', function() {
// Overwrite Core theme styles with empty styles.
wp_deregister_style( 'wp-core-blocks-theme' );
wp_register_style( 'wp-core-blocks-theme', '' );
}, 10 ); This appears to work well today to omit When I originally added |
I'm OK with the solution by @brandonpayton. But perhaps This is my current setup for the editor and works just fine: Edit: using hook
|
Just a quick note that the handle for deregistering theme.css is now |
I updated code snippet. |
As best I can tell, there are no actionable tasks remaining here? Proactively closing until told otherwise. |
I think the request is to make it easier to dequeue theme.css from the editor since the current method is not the standard WordPress way. Normally you would just dequeue the style, but we have to deregister it and then register a non existent file in its place. Not the sort of thing that can be found easily so I think it should either:
|
Thanks for clarifying the actionable tasks. I'll reopen. |
Based on how the gutenberg/lib/client-assets.php Lines 1001 to 1040 in 5800ed3
|
Looks like that would work for gutenberg/lib/client-assets.php Lines 660 to 671 in 5800ed3
|
Also noting that we are talking how dequeueing styles in the editor using |
I am developing a custom theme with Gutenberg and am having trouble dequeueing/degrestering the styles added by:
I've tried all of the code snippets listed in this thread and I'm not able to remove the following:
What am I missing? |
@samikeijonen The code from that answer doesn't work for me. I've tried it both with and without:
Is this part:
important? |
@persianturtle I think you are trying to dequeue gutenberg stylesheet in the front-end but this thread is about removing it from the editor. In the front-end the classic solution will do just fine (at the moment). Something like this should work.
|
btw, i think this statement in gutenberg handbook is not how it is actually working in version 3.7.0: |
I have run into this issue also. I think it would be good to clarify the intent for what site developers are expected to do here. Consider the following situation:
Then what is the expectation? Should they be removing this stylesheet from Gutenberg? Or should they be wrestling with conflicting CSS and trying to overwrite these styles in their theme? If the expectation is that this should be removed, then it should be made easier to do so. The script |
+1 |
Can anyone help me understand what's the point of having |
Any reason to enqueuing it even when it's (apparently) not used at all? |
You're correct, there is no point. I'd consider this as bug in Classic Editor plugin. |
I personally think this is a Classic Editor plugin concern and not something Gutenberg should have to deal with. The rationale, in the words of a contributor to the Classic Editor plugin, is:
Just so we're clear about the fact that it's not a "bug". If the Classic Editor team isn't interested in it, then it's not like removing the CSS file from the front- and back-ends ourselves is really the worst thing, especially if you do it as an |
Hey What is the status of this issue? I will also ping |
I made a PR for this here: #29252 |
This is solved now. |
Is your feature request related to a problem? Please describe.
At the moment it's pretty hard to dequeue
theme.css
from the editor. See comment from issue 5360.With that comment I think I need to replace the original
theme.css
with empty one:But I feel this is not the best practise, or there might be better way of doing this?
Describe the solution you'd like
To be honest I haven't looked the decencies that deep so that I could suggest solution. But I'd hope we look into this more.
The text was updated successfully, but these errors were encountered: