Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add assets to Query Monitor #66

Open
renatonascalves opened this issue Dec 18, 2024 · 1 comment · May be fixed by #67
Open

Add assets to Query Monitor #66

renatonascalves opened this issue Dec 18, 2024 · 1 comment · May be fixed by #67
Assignees
Labels
enhancement New feature or request php Requires understanding PHP

Comments

@renatonascalves
Copy link
Contributor

Description

In a project, while adding the following asset, I noticed it is not registed in Query Monitor:

'header-footer' =>
[
	'types'       => [ 'script', 'style' ],
	'script_args' => [ 'load_method' => 'defer' ],
	'style_args'  => [ 'load_method' => 'async' ],
],

@goodguyry confirmed here the reason.

async style loading is different from async js loading. async doesn’t exist for styles, it’s a hack. it sets the stylesheet as a print stylesheet, which allows it to load but keeps the browser from applying the styles. then once the file is loaded, the print media attribute is replaced, at which point the browser applies the styles.

Use Case

Stylesheet assets added by this plugin appear in Query Monitor, just like assets added by wp_enqueue_style. Even though they have different implementations, they should be visible to a developer.

@renatonascalves renatonascalves added the enhancement New feature or request label Dec 18, 2024
@renatonascalves renatonascalves self-assigned this Dec 18, 2024
@renatonascalves renatonascalves added the php Requires understanding PHP label Dec 18, 2024
@renatonascalves
Copy link
Contributor Author

renatonascalves commented Dec 18, 2024

I'm currently testing an approach in a client site, that essentially means adding the file to WP_Dependencies, faking its addition without actually enqueuing it. But need to confirm any possible side effects .

@renatonascalves renatonascalves linked a pull request Dec 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request php Requires understanding PHP
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant