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

min and max arguments to calculate sizes automatically #26

Closed
callumacrae opened this issue Dec 13, 2016 · 4 comments · Fixed by #31
Closed

min and max arguments to calculate sizes automatically #26

callumacrae opened this issue Dec 13, 2016 · 4 comments · Fixed by #31

Comments

@callumacrae
Copy link
Contributor

Hey! I'm currently attempting to integrate a responsive images loader into html-loader, as currently it just outputs full sized images.

Would you accept a PR enabling this syntax?

require('responsive?min=100&max=300!./myImage.jpg');

From there, it'll calculate the best sizes (maybe another argument to say the number of images?), and generate the images. This could be done from html-loader, but I figure it's best to do it from the place that actually accesses the image file so that max can be taken down if necessary.

callumacrae added a commit to callumacrae/html-loader that referenced this issue Dec 13, 2016
Syntax being called doesn't actually exist yet:
dazuaz/responsive-loader#26
@jstcki
Copy link
Contributor

jstcki commented Dec 29, 2016

How would you calculate the "best" sizes?

@callumacrae
Copy link
Contributor Author

callumacrae commented Dec 30, 2016

Steps? Maybe something smart like how http://www.responsivebreakpoints.com/ works, maybe just making n images between the two sizes

@jstcki
Copy link
Contributor

jstcki commented Jan 8, 2017

That could be pretty cool! We could even auto-generate useful sizes based on the original image's dimensions and some heuristics about devices used. Discarding images which are too close in file size would also be pretty straight-forward.

On the other hand, would it be that much of an improvement over specifying a preset of sizes in the webpack config? E.g.

{
  responsiveLoader: {
    sizes: [300, 600, 900, 1200]
  }
}

@callumacrae
Copy link
Contributor Author

I'm not sure how useful that would be, given that there's usually more than one size image displayed on a website. Maybe number of steps would be a useful option there - didn't know you could specify options.

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 a pull request may close this issue.

2 participants