WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 2 months 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:
PR Number:

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
3 months ago

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

#2 in reply to: ↑ 1 ; follow-up: @markhowellsmead
3 months 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
3 months 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
3 months 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
3 months 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
3 months ago

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

#8 @poena
3 months ago

I agree that non system fonts should be enqueued.

Version 0, edited 3 months ago by poena (next)

#9 @ianbelanger
2 months ago

#48922 was marked as a duplicate.

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


2 months ago

Note: See TracTickets for help on using tickets.