Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#48630 new enhancement

Twenty Twenty: please use wp_enqueue_style for the fonts

Reported by: markhowellsmead Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: 2nd-opinion dev-feedback
Focuses: ui, performance Cc:

Description

Please please use wp_enqueue_style for the fonts (not CSS @import), so that they can be dequeued by a Child Theme or Plugin. (In case the Child Theme or Plugin wants to use different fonts.)

Change History (10)

#1 follow-up: @nielslange
2 years ago

@markhowellsmead Where do you see @import statements for fonts?

#2 in reply to: ↑ 1 ; follow-up: @markhowellsmead
2 years ago

Replying to nielslange:

@markhowellsmead Where do you see @import statements for fonts?

Sorry, my bad - they're directly-referenced srcs in @font-face statements.

https://github.com/WordPress/twentytwenty/blob/master/style.css#L254

#3 in reply to: ↑ 2 @nielslange
2 years ago

  • Keywords needs-patch added

Sorry, my bad - they're directly-referenced srcs in @font-face statements.

https://github.com/WordPress/twentytwenty/blob/master/style.css#L254

Don't worry and thanks for clarifying this! 😉 I see what you mean now and will create a patch for that. If the patch gets accepted is another story though. 😁

#5 follow-up: @Otto42
2 years ago

I'm confused as to what the issue here is. If a child theme wants to use different fonts, it can do so simply by defining them as such in the child theme CSS.

#6 in reply to: ↑ 5 @markhowellsmead
2 years ago

Replying to Otto42:

I'm confused as to what the issue here is. If a child theme wants to use different fonts, it can do so simply by defining them as such in the child theme CSS.

This true, but the font files from the parent theme will still be loaded, which is a(n albiet minor) performance hit.

#7 @ianbelanger
2 years ago

  • Keywords 2nd-opinion dev-feedback added; needs-patch removed

#8 @poena
2 years ago

I agree that non system fonts should be enqueued.
Though I should probably learn more about variable fonts before I open my mouth ;)

Last edited 2 years ago by poena (previous) (diff)

#9 @ianbelanger
2 years ago

#48922 was marked as a duplicate.

This ticket was mentioned in Slack in #themereview by poena. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.