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

Generate Srcset / Sizes Attributes for Responsive Images #37

Open
sunnymui opened this issue Nov 15, 2019 · 0 comments
Open

Generate Srcset / Sizes Attributes for Responsive Images #37

sunnymui opened this issue Nov 15, 2019 · 0 comments

Comments

@sunnymui
Copy link

Images are currently just plain img tags ie
<img src="source.jpg" >

For full responsiveness, all images should be utilizing srcset and sizes attributes to do responsive image scaling so it loads the appropriate resolution image for the size of space it will be occupying. That also impacts page speed, since the browser no longer needs to download a higher resolution image than necessary for the fetching screen size.

<img src="one.png"
     srcset="two.png 100w, three.png 500w, four.png 1000w"

     sizes="<media condition> <width>,
            <media condition> <width>,
            <optional default image width>">

I believe the C4SJ site uses jekyll, which has a plugin to autogenerate the necessary markup:
https://github.com/wildlyinaccurate/jekyll-responsive-image

Tutorial to implement here:
https://medium.com/ivo-valchev/jekyll-responsive-images-with-srcset-5da131415d0f

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

No branches or pull requests

1 participant