WordPress / WordPress/plugin-check

Enqueued_Scripts_Size_Check includes script dependencies

Open
#74 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Team] Performance [Type] Enhancement Checks
Dominant language
PHP
Stars
362
Forks
126
Avg merge
1d 23h
Merged PRs (30d)
22

Description

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"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Enqueued_Scripts_Size_Check class and trace how it currently measures plugin and inline scripts. Review the WordPress WP_Scripts class to determine how dependencies are identified and how their sizes can be reported separately. Done means the check reports total page scripts, dependency size, and the detailed error message described in the acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.