Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #7284: Preload Fonts - Filter to add extensions #7318

Open
wants to merge 22 commits into
base: feature/3.19
Choose a base branch
from

Conversation

Miraeld
Copy link
Contributor

@Miraeld Miraeld commented Feb 21, 2025

Description

Fixes #7284
Adds a filter rocket_preload_fonts_processed_extensions to customize extension of fonts sent to the beacon script.

Example of usage:

apply_filters( 'rocket_preload_fonts_processed_extensions', function () {
	return [
		'woff2',
		'woff',
	];
});

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

What was tested

Integration tests are making sure that processed_extensions is added to the JS variable used by the beacon (rocket_beacon_data).

How to test

Just open a page that would include the beacon, and make sure that processed_extensions is added to the JS variable used by the beacon (rocket_beacon_data).
Also, you can change its value by using the filter rocket_preload_fonts_processed_extensions, example of usage:

apply_filters('rocket_preload_fonts_processed_extensions', function () {
return ['woff2', 'ttf'];
});

Technical description

Documentation

This pull request includes changes to the handling of font extensions in the rocket_beacon_data object and the addition of a filter for processed font extensions. The most important changes are the introduction of a new array for processed font extensions and the updates to various HTML fixture files to include this new data.

Enhancements to font extension processing:

Updates to HTML fixture files:

New dependencies

None

Risks

None

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

@Miraeld Miraeld self-assigned this Feb 21, 2025
@Miraeld Miraeld requested a review from a team February 21, 2025 04:05
@Miraeld Miraeld linked an issue Feb 21, 2025 that may be closed by this pull request
Copy link

codacy-production bot commented Feb 21, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for af70f6b1 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (af70f6b) Report Missing Report Missing Report Missing
Head commit (66e28e4) 39736 17435 43.88%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7318) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Base automatically changed from feature/preload-fonts to feature/3.19 February 24, 2025 13:45
Copy link
Contributor

@wordpressfan wordpressfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter is not working now because of the mentioned line.

@Miraeld Miraeld requested a review from wordpressfan February 28, 2025 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.19 - Preload Fonts - Filter to add extensions
3 participants