You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a Frontend Controller Class: WP_Rocket\Engine\Media\PreloadFonts\Frontend\Controller to implement use WP_Rocket\Engine\Common\PerformanceHints\Frontend\ControllerInterface;
Create 2 mandatory method ( optimize & add_custom_data ), to match the interface here and will focus on optimize method to process the frontend optimization.
In optimize we parse 2 arguments, html buffer & DB row:
Bail out if status is not completed or fonts column is empty array or empty( depending on what decide to insert when DB is empty )
Add logic to update buffer and format the link tag to include the font url to be preloaded
Create ServiceProvider in the PreloadFonts namespace if not created, else update it.
Add tests
Optimization should be done for font weight/style pairings as they might have different fonts.
This is handled on the beacon
The markup will be added before the Used CSS if enabled
User Story
As a user, I want to see the preload font applied to frontend once enabled while data exists in the database
Acceptance Criteria
<link rel="preload" data-rocket-preload as="font" href="path/to/font.woff2">
The text was updated successfully, but these errors were encountered: