npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@unpic/astro

v0.1.0

Published

A high-performance, responsive image service and component library for Astro

Downloads

3,943

Readme

tree

@unpic/astro

A high-performance, responsive image service and component library for Astro. Generates a responsive <img> tag that follows best practices, with the correct srcset, sizes and styles. Detects image URLs from most image CDNs and CMSs and can resize images with no build step.

@unpic/astro has two parts, which can be used independently but work best together:

  • A component library which provides a <Image> component and a <Source> component for art direction.
  • An Astro image service, which allows you to use the regular Astro Image component unchanged, and have it automatically generate the correct srcset and attributes for all images.

Features

  • Just an <img> tag! No extra elements, no runtime JavaScript. Easy to style.
  • Automatically generates correct srcset and sizes attributes for responsive images
  • Handles responsive resizing of images, preserving aspect ratio
  • Uses native lazy loading and aync decoding for offscreen images
  • Handles different image layouts: fixed, constrained and full width
  • Uses eager loading and high priority fetching for important images
  • Delivers modern image formats, including WebP and AVIF if supported by your browser
  • No built step or server-side rendering required: uses your existing image CDN or CMS, with no additional configuration
  • Supports most image CDNs and headless CMSs, including Cloudinary, Contentful, Imgix, and Shopify
  • Generates image placeholders to display while images are loading.

Installation and usage

npm install @unpic/astro
---
import { Image } from "@unpic/astro";
---

<Image
  src="https://cdn.shopify.com/static/sample-images/bath_gcrop_center.jpeg"
  layout="constrained"
  width={800}
  height={600}
  alt="A lovely bath"
/>

For the supported props, see the docs.