-
Notifications
You must be signed in to change notification settings - Fork 384
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 RewriteAmpUrls transformer #5078
Conversation
Plugin builds for 3813325 are ready 🛎️!
|
I found out why all the tests succeed, while it doesn't seem to do anything on the actual site: The quick fix would be to move it before the Optimizer. However, the proper fix would be to add automatic extension resolution to either the Sanitizer or the Optimizer. Note: The Node.JS Optimizer has a transformer for this: https://github.com/ampproject/amp-toolbox/blob/master/packages/optimizer/lib/transformers/AutoExtensionImporter.js |
Preliminary testingWithout ESM: With ESM: The difference is not huge but impactful nevertheless. I assume that this will further improve as the ESM tooling for The implementation currently causes the following AMP validation issues:
Note that the plugin's validation does pass successfully, as we have a chicken&egg problem, due to the fact that the sanitizer & validator are the same thing. The Optimizer would conceptually need to run after the sanitizer but before the validator. As it is now, it runs after both of these, as they can't be separated. Therefore, any validation issues that the Optimizer introduces won't be caught if they would be detected by a sanitizer like the |
Yes, I think we need to basically promise that the the Optimizer's transformers are not going to cause invalid output. That's the current state of things. Also, the |
This PR needs to be transferred over to https://github.com/ampproject/amp-toolbox-php/. |
howdy, all. The validator should now allow these transformations to be valid. Is there a way for us to test this out? |
@erwinmombay This PR is stale and needs to be re-started on the amp-toolbox-php repo, so it's not really in a testable state. We're working on getting AMP plugin v2.1 out the door (which includes the hero image prerendering), and once that's out we'll be able to focus on other Optimizer improvements. |
Summary
Adds the
RewriteAmpUrls
transformer.This is used for switching URLs to an AMP LTS channel or for adding ESM support when loading the runtime and components.
Fixes ampproject/amp-toolbox-php#20
Fixes #4600
Checklist