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 #7038 Activate minification by default #7052

Open
wants to merge 8 commits into
base: feature/3.18
Choose a base branch
from

Conversation

Khadreal
Copy link
Contributor

@Khadreal Khadreal commented Oct 22, 2024

Description

Fixes #7038
Activate minification by default.

Type of change

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

Detailed scenario

Check EPIC Card

Technical description

Change the value of minify_css/js to 1 to activate it by default.

Documentation

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.

@Khadreal Khadreal self-assigned this Oct 22, 2024
@Khadreal Khadreal marked this pull request as ready for review October 22, 2024 17:51
Copy link

codacy-production bot commented Oct 22, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 815e6391 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (815e639) Report Missing Report Missing Report Missing
Head commit (cb1dccc) 38120 16695 43.80%

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 (#7052) 2 2 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.

@Khadreal Khadreal requested a review from a team October 22, 2024 17:51
@Miraeld
Copy link
Contributor

Miraeld commented Oct 23, 2024

I'm approving the change as it's ok for me. However,
This is a 3.18 feature, should we merge it onto develop or a 3.18 branch ?

@remyperona
Copy link
Contributor

We should create a branch-3.18 and merge it in it for now

@Miraeld Miraeld changed the base branch from develop to feature/3.18 October 24, 2024 11:06
@Miraeld
Copy link
Contributor

Miraeld commented Oct 24, 2024

Created a feature/3.18 branch and rebased this PR on it :)

@Mai-Saad
Copy link
Contributor

Mai-Saad commented Oct 31, 2024

Waiting confirmation about AC here https://wp-media.slack.com/archives/CUKB44GNN/p1730380086011399 => confirmed. @Khadreal can you please check multisite and safe mode scenarios 🙏

@Khadreal Khadreal requested a review from Miraeld November 7, 2024 12:18
Copy link
Contributor

@jeawhanlee jeawhanlee left a comment

Choose a reason for hiding this comment

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

According to the grooming, don't we need to also do this for safe mode as well?

@Mai-Saad
Copy link
Contributor

Mai-Saad commented Dec 4, 2024

@remyperona remyperona added this to the 3.18 milestone Dec 4, 2024
@Mai-Saad
Copy link
Contributor

Mai-Saad commented Dec 10, 2024

@Khadreal Thanks for the update.
Please note that if Autoptimize is enabled with CSS feature on , with fresh install of WPR, we should dimm our Minify js and CSS => now it's checked in UI and dimmed (it shouldn't be checked) and it exists in the meta tag for WPR (it shouldn't)
Screenshot from 2024-12-10 09-05-25
Screenshot from 2024-12-10 09-04-52

While expected to be like on 3.17.3.1
Screenshot from 2024-12-10 09-15-38

Copy link

codacy-production bot commented Dec 11, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.01% (target: -0.10%) 55.56% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (ce94d1f) 38262 16746 43.77%
Head commit (f3667a4) 38269 (+7) 16747 (+1) 43.76% (-0.01%)

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 (#7052) 9 5 55.56%

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

Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be happening

*/
function rocket_maybe_disable_minification( $options ) {
if ( 'on' === get_option( 'autoptimize_css' ) ) {
update_rocket_option( 'minify_css', 0 );
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use the rocket_first_install_options filter, there shouldn't be any update_rocket_option() call since the option itself doesn't exist yet.

setting the array value to 0 should be enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

Totally agree with @remyperona
@Khadreal can u replicate the issue mentioned by Mai? for me I can't (after removing the callback rocket_maybe_disable_minification)

image

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.

Activate Minification by default
6 participants