-
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
Move hero image preload out of experimental #814
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.
LGTM
} | ||
} | ||
return 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.
continuing my series of "unhelpful comments that make the code less readable"...
return [...head.children].any(this.isImagePreload)
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.
Why the destructuring? I think head.children.some(this.isImagePreload);
does the trick as well (and is easy to read).
@@ -6,6 +6,7 @@ | |||
<link rel="preload" href="https://cdn.ampproject.org/v0.js" as="script"> | |||
<script data-auto async src="https://cdn.ampproject.org/v0.js"></script> | |||
<script async src="https://cdn.ampproject.org/v0/amp-video-0.1.js" custom-element="amp-video"></script> | |||
<link rel="preload" href="https://amp.dev/static/samples/img/tokyo.jpg" as="image" data-hero> |
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.
just for my own edification - what is the purpose of the data attr?
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.
For being able to track which images have been identified as hero images
For images that have |
This also changes the transformer to only run if there a no pre-existing image preloads.