Conversation
|
Size Change: 0 B Total Size: 1.37 MB ℹ️ View Unchanged
|
|
👋 I have two thoughts about this:
|
Correct
The problem is that core doesn't have a method to load fonts... As a result plugins & themes are forced to deal with it anyway and re-invent the wheel every time. There have been proposals to add an API to allow loading webfonts with a consistent method, but that's a big project on its own and will probably take a long time before something can land in core. |
a866186 to
3fc9a53
Compare
|
Rebased the PR and fixed a conflict, this is now again ready for a review. |
|
In #34843 I'm asking people for thoughts about consolidating parts of the global styles API, particularly the API for themes & plugins to get access to the data from |
Description
While working on an FSE theme and trying to figure out how to load webfonts, it became apparent that there is currently no way for a theme to determine if a webfont defined in the
theme.jsonfile is actually used. As a result, themes are forced to always load webfonts they want to use.This PR adds a
global_stylesfilter to allow 3rd-party developers (both in themes and plugins) to filter the global styles on the frontend in order to add things if needed.Example for the webfont:
Types of changes
gutenberg_experimental_global_styles_get_stylesheetfunction's return.Checklist: