Skip to content

Enqueued_Scripts_Size_Check includes script dependencies #74

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

Open
jjgrainger opened this issue Feb 8, 2023 · 1 comment
Open

Enqueued_Scripts_Size_Check includes script dependencies #74

jjgrainger opened this issue Feb 8, 2023 · 1 comment
Labels
Checks Audit/test of the particular part of the plugin [Team] Performance Issues owned by Performance Team [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@jjgrainger
Copy link
Contributor

The Enqueued_Scripts_Size_Check only accounts for scripts registered by the plugin that include the plugins URL in the script. There may be cases where a script requires a dependency that is sources outside of plugin directory, such as jQuery.

The Enqueued_Scripts_Size_Check should be updated to account for those external dependencies as part of the total script size for a page load.

Acceptance Criteria

  • Update the Enqueued_Scripts_Size_Check class to account for external dependencies.
  • Dependencies will be determined for a script using the WP_Scripts class.
  • The dependency sizes will be stored separately from the plugin scripts sizes to help with reporting.
  • Check error message will have detailed reporting highlighting.
    • The total script size enqueued for the page, including plugin scripts and inline scripts
    • The total size of script dependencies.
    • For example - "The total size of scripts enqueued for the page are X with dependencies adding X"
@jjgrainger jjgrainger added [Type] Enhancement A suggestion for improvement of an existing feature Checks Audit/test of the particular part of the plugin 11 labels Feb 8, 2023
@jjgrainger jjgrainger moved this to Definition in Plugin Check Feb 8, 2023
@swissspidy swissspidy added [Team] Performance Issues owned by Performance Team and removed Milestone 3 labels Jun 6, 2024
@swissspidy
Copy link
Member

This will require some logic similar to load_script_textdomain to get the file path from the script URL.

Might be easiest to first converge this class with Enqueued_Styles_Size_Check (e.g. by adding an abstract class or trait) so this logic can be reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Checks Audit/test of the particular part of the plugin [Team] Performance Issues owned by Performance Team [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants