-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
This is a fun edge case bug:
When a script ("child") is concatenated with another script that it requires ("parent"), but also uses wp_add_inline_script()
with the third argument being before
, any code that has dependencies on the parent script will fail.
Just as an example:
- The Shortcake plugin registers select2 with a dependency on jQuery
- It then adds an inline script that depends on jQuery, but wants it output before the select2 JS file.
- The nginx-http-concat plugin will output the before script
- The nginx-http-concat plugin will output the concatenated blob
- If the parent and child script are in the same blob, the before JS will fail.
I believe what needs to be done is to check if a script has a wp_add_inline_script()
with a before , it would be good to break the blob apart at that exact script, output the inline script, and then the concatenated blob.
We could get more detailed and check if any parent/child dependencies exist within the same blob first.
Metadata
Metadata
Assignees
Labels
No labels