-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: introduce custom srcsets #28
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.
Overall, this looks good to me. I just want to pose some questions about how we could possibly make this experience better:
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.
This is almost there, just some final nitpicks and questions.
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.
Wooo 👍
This PR implements custom srcsets by extending the parameter lists of
GenerateTargetWidths
,BuildSrcSet
,GenerateSrcSetDPR
, andGenerateSrcSetPairs
.First, target widths functionality was extended to support
begin
ningand
end
ing at user-specified target widths where each subsequentwidth increases within the specified
tol
erance. This was done toprepare
GenerateSrcSetPairs
to accept a custom list of target widths.Finally,
GenerateSrcSetDPR
has been extended to accept thedisableVariableQuality
flag. Whentrue
, varied image outputquality is disabled. Passing "q" without disabling variable quality
exhibits the same behavior as passing "q" and disabling variable
quality.
During the development of this feature we decided that
SrcSetWidthTolerance
should be afloat
i.a.w. ourimgix-core-js implementation.
The last portions implemented here is validation. We validate that
begin
,end
, andtol
represent a valid srcset width range. Wealso validate that any custom list of
widths
is not empty,null
,or does not contain negative "width" values.