Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#49470 new defect (bug)

Script loader: simplify maintenance

Reported by: azaozz's profile azaozz Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 5.0
Component: Script Loader Keywords: needs-patch
Focuses: Cc:


The main functionality of script-loader is to provide a list of all WordPress scripts and stylesheets together with their dependencies, translation objects and extra/inline code.

During the WP 5.0 development a few (shorthand) functions were introduced that output hard-coded data used to "construct" that list by running several loops instead of the simpler, one-line definitions like in the pre-existing list. This makes it harder to "see" and maintain the entries in the list, and doesn't bring any benefits (all data is still hard-coded, but is now in separate places). It also makes it harder to "dynamically" extract and construct the scripts list like in #48154.

For best results and easier maintenance the "helper functions" introduced in WP 5.0 should be removed and the list of scripts in wp_default_scripts () should include all entries.

Change History (5)

#1 @azaozz
4 years ago

  • Keywords needs-patch added

Looks like an exception would be wp_tinymce_inline_scripts() as it duplicates some of the functionality from class-wp-editor.php, but worth another look at how to do that better.

Another case to try to improve is outputting the polyfills (get rid of document.write, etc.).

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.

4 years ago

#3 @davidbaumwald
4 years ago

@azaozz Is this still doable for 5.5?

#4 @azaozz
4 years ago

  • Milestone changed from 5.5 to Future Release

This is still mostly TBD. Lets move it to future release.

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.

4 years ago

Note: See TracTickets for help on using tickets.