Add experimental image preloading support#730
Merged
sebastianbenz merged 3 commits intomasterfrom May 4, 2020
Merged
Conversation
Collaborator
Author
|
@patrickkettner forgot to mention before, the srcset parser & tests do not need to be reviewed as they're copied form amphtml. |
patrickkettner
approved these changes
May 4, 2020
Collaborator
patrickkettner
left a comment
There was a problem hiding this comment.
sorry it took so long
few questions, but LGTM
| for (let i = 0; i < sources.length; i++) { | ||
| const source = sources[i]; | ||
| let src = source.url; | ||
| if (opt_mapper) { |
Collaborator
There was a problem hiding this comment.
im assuming we aren't exposing this to a public api? Otherwise do we need any kind of enforcement on it being a func, or is the normal opt_mapper is not a function error that would be generated sufficient?
Collaborator
Author
There was a problem hiding this comment.
You're right, we are not
|
|
||
| if (!width && !height) { | ||
| if (layout === 'fill') { | ||
| console.log('getting dim parent', this.nodeDimensionsFromParent(ampImg)); |
Collaborator
There was a problem hiding this comment.
should this be this.log?
4f13ca9 to
3529042
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new transformer that uses a set of heuristics to detect an hero image on an AMP page and inject a preload directive to speed up rendering.