-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
block-library/style.min.css was added without wp-block-styles supprt in theme #21658
Comments
If I understand correctly Theme may already includes necessary block styles. So I think there are should be way to remove duplicated styles by |
It would be nice to have options:
What do you think? |
Hello! Thanks for the ticket. Yes, some block styles are enqueued regardless of theme opt-in. This is necessary for many blocks in order for them to function at all, for example the Columns block relies heavily on complex CSS flex rules, and would not be columns at all unless it came with some basic CSS styles. On the other end of the spectrum, the Paragraph block should not come with any styles at all, perhaps obviously. In between those two extremes is a gray area that has changed a fair bit since the editor project started 3 years ago. Back then, very few themes styled the As the editor and themes have matured, this has been adjusted, and numerous styles have been moved to become "opinionated styles", that includes things like a left border on a blockquote block, things like that. Those opinionated styles are what you opt into, when you declare support using It does not seem feasible to omit styles if a theme declares itself to have "full block compatibility", because you might install a block from a plugin, like the Columns block, that simply does not work without structural CSS. So instead of a blanket opt-out, I would encourage opening individual tickets for each style you feel should not be part of the default block style, but should be moved to "opinionated". You can CC me on such tickets, and I'll be sure to categorize them properly! |
Hi @jasmussen Thank you for explaining. Now I understand the history and use cases of these two styles. But I have the idea to discuss.
So including additional default styles is not necessary. Of course as a theme developers we may dequeue this styles: add_action('wp_enqueue_scripts', function () {
wp_dequeue_style( 'wp-block-library' );
}); I think it will be useful to have mention in the documentation about default styles (not default opinionated styles as is for now) and impact of removing it. |
Agreed. I think the ticket to follow there is this one: #5445.
Absolutely, it's pretty important that the styles provided by blocks and indeed the editor are as unspecific and easy to override as possible. There are two good tickets to follow for developments there, #11779 and #10178. An additional recent development is the idea of putting the editor in an iframe (#21102), which might allow the editor to reduce specifity even further. In addition to that, a recent feature was merged, #19701, which will enable blocks in the editor to have markup that is more similar to the rendered markup on the frontend, further simplifying the styling of blocks. Hope that helps! |
Thanks, Actually #5445 describes different issue of building specific bundles form used on page blocs. I do not find it useful to create 2^N bundles and kill cache in pre HTTP/2 era. I mean more simple |
Ah yes. But it does seem like related aspects have popped up in conversation on that ticket, and so as to keep related things together, I would recommend you comment on that thread. |
@jasmussen Yep, done! Some thoughts #5445 (comment) |
Describe the bug
block-library/style.min.css
styles was added without settingadd_theme_support( 'wp-block-styles' );
To reproduce
Steps to reproduce the behavior:
add_theme_support( 'wp-block-styles' );
enabled./wp-includes/css/dist/block-library/style.min.css?ver=5.3.2
added to the page.Expected behavior
No
block-library
styles except if setadd_theme_support( 'wp-block-styles' );
according to documentation https://developer.wordpress.org/block-editor/developers/themes/theme-support/#default-block-stylesEditor version (please complete the following information):
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: