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: create custom srcset #63

Merged
merged 4 commits into from Apr 17, 2020
Merged

feat: create custom srcset #63

merged 4 commits into from Apr 17, 2020

Conversation

ericdeansanchez
Copy link
Contributor

The purpose of this PR is to implement custom srcset behavior by supporting:

  • custom min and max widths
  • custom width tolerance

This PR also seeks to do this without changing the public API.

This PR has been split into three commits:

  • validate min, max, and width tolerance
    • to call one validator instead of three
    • test
  • implement custom target widths
    • pull target width generation into UrlBuilder.py
    • this is where the validation occurs
    • test
  • custom srcset widths and tolerance
    • validation is done here as well (so that create_srcset and target_widths can be used separately)
    • extend the API to support custom srcset generation by specifying:
      • custom min/max widths and
      • width tolerance.

Note: There have been 220 additions and 25 deletions here, however, more than 117 of theses additions are documentation and comments.

EDIT: The fourth commit improves the test cases for validate_min_max_tol

@ericdeansanchez ericdeansanchez marked this pull request as ready for review April 16, 2020 16:12
@ericdeansanchez ericdeansanchez changed the title Create custom srcset feat: create custom srcset Apr 16, 2020
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 looks great! I just have a few follow up questions.

imgix/urlbuilder.py Show resolved Hide resolved
imgix/urlbuilder.py Show resolved Hide resolved
imgix/urlbuilder.py Show resolved Hide resolved
@ericdeansanchez ericdeansanchez merged commit 83ef123 into master Apr 17, 2020
@ericdeansanchez ericdeansanchez deleted the create-custom-srcset branch April 17, 2020 20:28
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.

None yet

2 participants