Skip to content

Conversation

@haqadn
Copy link
Contributor

@haqadn haqadn commented Apr 21, 2025

Fixes HOG-17
Fixes #40365

Proposed changes:

  • Introduce a new filter to control the maximum number of files allowed to be concatenated, jetpack_boost_minify_concat_max_files
  • If a CSS/JS group is bigger than the allowed number of files, chunk them into groups of the allowed size, default 150.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Activate minify JS/CSS and create a page with a lot of CSS or JS files enqueued. This part is manual and I don't have a good suggestion to achieve. I guess install a few plugins that add front-end JS and CSS.
  • Use the following filter to customize the number of CSS/JS files:
add_action( 'jetpack_boost_minify_concat_max_files', function( $_max_files ){ return 3; } );
  • Ensure that the concatenated files (_jb_static, and boost-cache/static) are grouped by less than or equal to the given number of files given above '3'.

@haqadn haqadn requested a review from a team April 21, 2025 19:10
@haqadn haqadn self-assigned this Apr 21, 2025
@haqadn haqadn added [Status] Needs Review This PR is ready for review. Bug [Type] Bug When a feature is broken and / or not performing as intended labels Apr 21, 2025
@github-actions github-actions bot added the [Plugin] Boost A feature to speed up the site and improve performance. label Apr 21, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Boost plugin:

  • Next scheduled release: April 30, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Apr 21, 2025
@haqadn haqadn added [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. Bug [Type] Bug When a feature is broken and / or not performing as intended labels Apr 21, 2025
@jp-launch-control
Copy link

jp-launch-control bot commented Apr 21, 2025

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/plugins/boost/app/lib/minify/class-concatenate-css.php 0/99 (0.00%) 0.00% 2 ❤️‍🩹
projects/plugins/boost/app/lib/minify/class-concatenate-js.php 0/145 (0.00%) 0.00% 2 ❤️‍🩹
projects/plugins/boost/app/lib/minify/functions-helpers.php 0/140 (0.00%) 0.00% 1 ❤️‍🩹

Full summary · PHP report · JS report

Copy link
Member

@dilirity dilirity left a comment

Choose a reason for hiding this comment

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

I don't think this is working (for CSS at least).

I've added the filter with 3 max files, but the page is broken.

Here's the source of concatenated files:

CleanShot 2025-04-22 at 16 59 53

I added elementor and a couple of blocks to make it output a lot of stylesheets. Just to make sure my tests are okay, I switched to trunk and everything works.

@haqadn haqadn changed the title Boost: Gracefully handle more overflow of max concat files Boost: Gracefully handle overflow of max concat files Apr 23, 2025
@haqadn haqadn requested review from a team and dilirity April 24, 2025 12:41
Copy link
Member

@dilirity dilirity left a comment

Choose a reason for hiding this comment

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

Awesome! CSS now works as well. Let's merge this!

:shipit:

@dilirity dilirity merged commit d2982c3 into trunk May 5, 2025
69 checks passed
@dilirity dilirity deleted the fix/concat-max-file-overflow branch May 5, 2025 09:26
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label May 5, 2025
simison pushed a commit that referenced this pull request May 6, 2025
Co-authored-by: Peter Petrov <peter.petrov89@gmail.com>
@haqadn haqadn added this to the boost/3.14.0 milestone May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Plugin] Boost A feature to speed up the site and improve performance. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boost: Chunk concatenated JS/CSS urls

3 participants