-
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
Do not add to the block-library CSS bundle the colors that come from theme.json
#33924
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f161b02
Do not import the CSS that comes from theme.json
oandregal b5134f4
Use gradient-colors-deprecated
oandregal 90dd246
Remove no longer user mixins
oandregal 465777f
Add deprecation note
oandregal 0d1a0ec
Add changelog for block-library
oandregal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these mixins still necessary/used somewhere? Should we remove them as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't found any place where they're used. The reason I didn't remove them was that they're part of the
base-styles
package API so I'm not sure how do we want to go about that: do we want to keep them for third parties?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a development package, so I think you can just remove them and add a breaking change note to the changelog file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question I have is what happens when you instantiate a default block editor instance (just JS no backend), will you get decent defaults for theme.json configs/palettes/styles... How does that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that the
block-editor
was never concerned with providing the CSS for default colors, the CSS was there by other means.Historically, that CSS was provided by the
block-library
and in currenttrunk
is provided by theblock-library
and the server code for global styles. This PR removes theblock-library
CSS. It doesn't change anything for theblock-editor
. Is this your reading as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the unused mixins at ce60eae Added a changelog note at dff2e85
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like you're right, though it does bother me a bit because block-library is something third-party editors can easily load but the theme.json CSS is not.
Take a look at the playground for instance https://wordpress.github.io/gutenberg/?path=/story/playground-block-editor--default
You can see that the block-library stylesheets are loaded there but with this PR they won't be. This won't break styles of the editor immediately because we add the "inline styles" for colors for backward compatibility but the classNames won't have any impact.
So it seems for me, this PR should be fine to land because it doesn't have a conceptual impact but it highlights one that we should tackle at some point. What should we do with the styles generated from theme.json: are these styles that the block editor should render based on its settings? Does the block editor work as it should without them? Should this style generation be baked or at least have a dedicated API/function in the frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'd need a 👍 to land this then.
Do we want to add a breaking change to the
block-library
changelog as well? It's not directly an "API" but it seems consumers would be expecting those styles anyway.I can look at what you mention as a follow-up. I'm around that area with #32702 so can probably dig deeper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created an issue for it at #34005
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's add the changelog mention and ship.