Skip to content

Webfonts: remove unused font-face declarations #39332

@creativecoder

Description

@creativecoder

What problem does this address?

The initial Webfonts API adds @font-face declarations for every font-family that is registered, regardless if it is used in the css for the page, or not.

With a few fonts, this is not too bad, but with additional font weights and styles, it can quickly add up. One example: Jetpack is adding a Google fonts module, and with ~30 Google fonts registered, there are over 1500 font-face declarations, adding well over 500 KB (uncompressed) to the page source.

What is your proposed solution?

Remove unused font-face declarations on each page to reduce the size of what is added to the page source.

Related tasks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions