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

Fix: avoid useless loading of scripts #64

Open
wants to merge 7 commits into
base: release/v2.5.0
Choose a base branch
from

Conversation

AleTorrisi
Copy link
Contributor

@AleTorrisi AleTorrisi commented Jan 14, 2025

Proposed changes

Added a code to load conditionally bulk image optimizer scripts according the page which is loaded, and the admin style only in case visit the plugin panel page.

Type of Change

Production

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Video

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

circlecube
circlecube previously approved these changes Jan 16, 2025
Copy link
Member

@circlecube circlecube left a comment

Choose a reason for hiding this comment

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

This looks good.

My only suggestion would be to consider using an allowed list rather than an excluded list of pages. There are probably fewer pages for the allow list and we can be sure that over time that this is easier to manage.

@AleTorrisi
Copy link
Contributor Author

@circlecube thanks for your suggestion. Before creating the pull request I discussed about that with @arunshenoy99 and we agree that set a list of pages where include the script is risky because the image optimized feature works on media library and it could be managed by a third-part plugins which works outside the list of pages declared.
At the moment I put a list of pages where it's very unlikely that it happens, allowing usage of script elsewhere.
I remain at your disposal

Copy link
Member

@arunshenoy99 arunshenoy99 left a comment

Choose a reason for hiding this comment

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

The code looks good to me. Will get this QA’d once before merging. Thanks!

@arunshenoy99 arunshenoy99 changed the base branch from main to release/v2.5.0 January 28, 2025 19:00
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.

4 participants