aFarkas / lazysizes

High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration.
MIT License
17.45k stars 1.73k forks source link

[Docs] lazySizes object fit extension docs should mention the postcss-object-fit-images postcss plugin #605

Open wujekbogdan opened 5 years ago

wujekbogdan commented 5 years ago

The documentation for the lazySizes object fit extension does mention that the polyfill is not a fully-automated solution and some CSS fiexes are required (font-family: "object-fit: contain/cover";)

In fact it could be automated by PostCSS plugin: ronik-design/postcss-object-fit-images.

It is a plugin that parses the CSS file and adds apropriate font-family declarations.

So It would be good to add a little note about it to docs.

aFarkas commented 5 years ago

From the docs:

To init the plugin on an image simply use the font-family property directly on your image.

.imagecontainer-img {
object-fit: contain;
font-family: "object-fit: contain";
}

But I will make it clearer for you.

wujekbogdan commented 5 years ago

@aFarkas I understand how it works, I'm just saying that it would be good to mention, in the docs, that there's no need to add font-family declarations manually because there's an automated solution - the postcss-object-fit-images plugin. That's my point.