Skip to content
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

Merged
merged 8 commits into from
Jun 4, 2020
Merged

feat: introduce custom srcsets #28

merged 8 commits into from
Jun 4, 2020

Conversation

ericdeansanchez
Copy link
Contributor

@ericdeansanchez ericdeansanchez commented May 6, 2020

This PR implements custom srcsets by extending the parameter lists of
GenerateTargetWidths, BuildSrcSet, GenerateSrcSetDPR, and
GenerateSrcSetPairs.

First, target widths functionality was extended to support beginning
and ending at user-specified target widths where each subsequent
width increases within the specified tolerance. This was done to
prepare GenerateSrcSetPairs to accept a custom list of target widths.

Finally, GenerateSrcSetDPR has been extended to accept the
disableVariableQuality flag. When true, varied image output
quality 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 a float i.a.w. our
imgix-core-js implementation.

The last portions implemented here is validation. We validate that
begin, end, and tol represent a valid srcset width range. We
also validate that any custom list of widths is not empty, null,
or does not contain negative "width" values.

@ericdeansanchez ericdeansanchez requested a review from sherwinski May 7, 2020 00:31
@ericdeansanchez ericdeansanchez marked this pull request as ready for review May 7, 2020 19:23
Copy link
Contributor

@sherwinski sherwinski left a 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:

Copy link
Contributor

@sherwinski sherwinski left a 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.

Copy link
Contributor

@sherwinski sherwinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wooo 👍

@ericdeansanchez ericdeansanchez merged commit d12f372 into master Jun 4, 2020
@ericdeansanchez ericdeansanchez deleted the custom-srcsets branch June 4, 2020 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants