#51709 closed feature request (duplicate)
Feature request / Enhancement: Script version dependencies
| Reported by: | keraweb | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Script Loader | Version: | |
| Severity: | normal | Keywords: | dev-feedback needs-design |
| Cc: | Focuses: |
Description
I couldn't find a similar ticket though I can hardly imagine no-one has asked this before.
Anyhow, sorry if this is duplicate!
Currently you can add script dependencies, which is already working very neat.
However, I think enhancing this feature with version dependencies would greatly enhance this part and allow plugins to re-use existing scripts if the version params support them.
This could also prevent some plugins from adding duplicate scripts.
Examples,
Register/Enqueue:
wp_register_script(
'myscript',
$url,
array (
'jquery' => '^1.12', // Any 1.x version higher than 1.12.
'bootstrap' => '4.*', // Any 4.x version
),
3.6
);
Checking if version exists:
wp_script_is( 'myscript', 'registered', '>3' );
This would also allow registering multiple scripts under the same handle but on a different version.
I can imagine a next step would be a script/asset manager through the UI where you could optionally dequeue some redundant scripts. For example, different versions of Bootstrap.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi there, welcome back to WordPress Trac!
Thanks for the ticket, we're already tracking this feature request in #47285.