Opened 4 months ago
Last modified 4 months ago
#61435 new defect (bug)
Style dependencies are not inlined
Reported by: | mosne | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.8 |
Component: | Script Loader | Keywords: | |
Focuses: | Cc: |
Description
in #50836 we added the ability to inline styles but
style dependencies to specific styles are not automatically inlined eventhough a path is provided.
The problem :
wp_register_style( 'alice', $url_alice ); wp_style_add_data( 'alice', 'path', $path_alice ); wp_register_style( 'bob', $url_bob, array( 'alice' ) ); wp_enqueue_style( 'bob' ); // output // <link rel='stylesheet' id='alice-css' href='...' media='all' /> // <link rel='stylesheet' id='bob-css' href='...' media='all' />
The expected result is to have alice inline before bob.
But alice is always loaded as external resources.
To achieve alice inline I have to manually wp_enqueue_style alice.
wp_enqueue_style( 'alice' ); wp_enqueue_style( 'bob' ); // output // <style id='alice-inline-css'>...</style> // <link rel='stylesheet' id='bob-css' href='...' media='all' />
Currently, wp_maybe_inline_styles only checks on enqueued styles
We should recheck if dependencies could be output inline.
How to reproduce: in attachment a child theme.
Attachments (1)
Change History (3)
Note: See
TracTickets for help on using
tickets.
Thanks for the report, @mosne. I think you meant to link to this commit [50836] rather than the ticket with the same number. For additional context, the ability to pass
path
as a value to the second parameter was documented in #53792.