-
Notifications
You must be signed in to change notification settings - Fork 243
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 amp-bind optimizer #1147
Add amp-bind optimizer #1147
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Two comments:
- using
data-amphtml-binding
instead ofI-amphtml-binding
would mean that we wouldn't have to update the validator - can you please add a test here: https://github.com/ampproject/amp-toolbox/tree/main/packages/optimizer/spec/transformers/valid. You can run
npm run optimier:test:snapshot
to generate the expected output files
this.log_ = config.log.tag('OptimizeAmpBind'); | ||
|
||
// setup implementation only if placeholder generation is enabled | ||
this.enabled_ = !!config.optimizeAmpBind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should enable this by default.
this.enabled_ = !!config.optimizeAmpBind; | |
this.enabled_ = config.optimizeAmpBind !== false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or did you intentionally leave this disabled until the validator changes are live?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this is intentionally disabled until validator changes are live in AMP Cache. I was gonna follow up with a PR to enable it afterwards.
//cc @westonruter @schlessera for porting this to the PHP optimizer. |
Co-authored-by: Sebastian Benz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- using data-amphtml-binding instead of I-amphtml-binding would mean that we wouldn't have to update the validator
I actually chose not to do this, since the attribute can only be valid in transformed outputs. Data attributes are always valid.
- can you please add a test here: https://github.com/ampproject/amp-toolbox/tree/main/packages/optimizer/spec/transformers/valid. You can run npm run optimier:test:snapshot to generate the expected output files
Working on that now.
this.log_ = config.log.tag('OptimizeAmpBind'); | ||
|
||
// setup implementation only if placeholder generation is enabled | ||
this.enabled_ = !!config.optimizeAmpBind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this is intentionally disabled until validator changes are live in AMP Cache. I was gonna follow up with a PR to enable it afterwards.
Tests added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
See ampproject/amphtml#32851
Part of ampproject/amphtml#27590