-
Notifications
You must be signed in to change notification settings - Fork 25
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
Investigate moving some extension scripts to the end of <body> #327
Comments
@ediamin As a start, it would be great to have a configuration value for the With such a configuration value, we'll then be able to write a small custom plugin to configure this via URL arguments for easy experimentation. |
Here's a prototype transformer for moving non-critical scripts to the end of the |
In the context of the AMP-WP plugin, this is something we may want to enable by default if we're not targeting AMP validity (cf. ampproject/amp-wp#6546). |
@westonruter Was that ever discussed with the AMP team to allow for moving AMP scripts to the body? I think that should be valid, given it can improve performance AND it is not in fact custom JS. |
Yes, some planning has gone into it but no amphtml issue has been created for it yet. It's not as simple as just making it valid as currently the runtime, validator, and optimizer are only expecting scripts in the |
I'll look into supporting this in the PHP validator and optimizer to see what changes would be needed. I don't know enough about the runtime though to go through that as well. |
Some extension scripts are only needed to power the interactivity for the user and are not necessary during the initial rendering process.
Moving these scripts to the end of the
<body>
tag instead of having them in the<head>
would thus likely improve LCP.We should investigate which extensions can safely be moved, and whether it is always a net win for CWV.
See this comment by @westonruter where he already experimented with this approach with promising results: ampproject/amp-wp#6182 (comment)
The text was updated successfully, but these errors were encountered: