Skip to content

Commit

Permalink
Closes #7064 CDN Compatibility for host fonts locally (#7169)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanna-meda authored Dec 9, 2024
2 parents 0c3c6fa + 5cee326 commit eb81681
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions inc/Engine/Media/Fonts/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public function write_font_css( string $font_url, string $provider ): bool {
$local_css = str_replace( $font_url, $local_url, $local_css );
}

// This filter is documented in inc/Engine/Optimization/CSSTrait.php.
$local_css = wpm_apply_filters_typed( 'string', 'rocket_css_content', $local_css );

$end_time = microtime( true );
$duration = $end_time - $start_time;

Expand Down
3 changes: 2 additions & 1 deletion inc/Engine/Media/Fonts/Frontend/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ private function get_optimized_markup(
}
}

$url = $this->base_url . $font_provider_path . 'css/' . $this->filesystem->hash_to_path( $hash ) . '.css';
// This filter is documented in inc/classes/optimization/css/class-abstract-css-optimization.php.
$url = wpm_apply_filters_typed( 'string', 'rocket_css_url', $this->base_url . $font_provider_path . 'css/' . $this->filesystem->hash_to_path( $hash ) . '.css' );

return sprintf(
'<link rel="stylesheet" href="%1$s" data-wpr-hosted-gf-parameters="%2$s"/>', // phpcs:ignore WordPress.WP.EnqueuedResources.NonEnqueuedStylesheet
Expand Down

0 comments on commit eb81681

Please sign in to comment.