An open API service indexing awesome lists of open source software.

https://github.com/otterdev-io/sanity-img

Sanity image tags for common frontend frameworks
https://github.com/otterdev-io/sanity-img

Last synced: 5 months ago
JSON representation

Sanity image tags for common frontend frameworks

Awesome Lists containing this project

README

          

# otterstack - sanity-img

An set of js framework components for rendering responsive `` elements for images fetched from [Sanity](https://www.sanity.io). They will generate the elements with a srcset optimised for a range of resolutions and formats, using sanity's image API to serve the optimised images. Then you provide the `sizes` attribute, to ensure the browser delivers the ideal source. Refer to [Responsive images - MDN](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images) for information on providing responsive images.

Then usage can be as simple as:

```astro
---
import SanityImg from "@otterstack/sanity-img-astro"
---

```

Refer to the readme file in each package for specific usage instructions in the relevant framework:

- [Astro](https://github.com/otterdev-io/sanity-img/tree/main/astro#readme)
- [Svelte](https://github.com/otterdev-io/sanity-img/tree/main/svelte#readme)

There is a sample project demonstrating its use in astro, with astro and svelte components, in the `examples/astro` directory.