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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eleventy-plugin-srcset

v0.5.0

Published

An Eleventy plugin which generates responsive images using Sharp

Readme

This Eleventy plugin generates responsive image markup along with the corresponding image files.

It can be used in two ways:

  1. The manually inserted shortcode, {% srcset %}
  2. The automatic filter mode, which finds images based on a provided CSS selector

Configuration

The plugin can be configured by passing a config object when adding the plugin, e.g.:

eleventyConfig.addPlugin( pluginSrcsetImg, {
  srcsetWidths: [540, 900, 1024],
  autoselector: '.post-content img',
  createCaptions: true
});

Configuration added will override the defaults given in the table below.

| Value | Details | Default | |---|---|---| |autoselector|Specifies the CSS selector used to automatically find elements you want to generate images and markup for. Set this to null if you do not want to find images automatically. |'.page-body img'| |srcsetWidths|An array of the breakpoint widths used to generate images|[ 320, 480, 640, 960, 1280, 1600 ]| |fallbackWidth|The width for the fallback 'src' image|640| |fallbackHeight|The height for the fallback 'src' image, when null the image will be automatic based on the aspect ratio and fallbackWidth|null| |createCaptions|When true, automatic mode wraps outputted tags in a tag with a whose text is a copy of the image's title attribute. This makes generating captions from markdown possible.|false| |resizeOriginal|When true, the original image will be resized.|true| |cropPosition|Specifies the default crop position for Sharp to use when cropping. Can be overridden on shortcode|gravity.centre| |dirs.input|Path to input directory|./src| |dirs.output|Path to output directory|./dist|

Using the shortcode

The shortcode syntax is:

{% srcset image, alt, className, width, height, sizes, cropPosition %}

| Attribute | Details | |---|---| |image| Path to input image| |alt|Image alt text| |className|Desired class of output image| |width|Image width (used to establish image aspect ratio)| |height|Image height (used to establish image aspect ratio)| |sizes|Image sizes attribute, e.g. "(min-width: 600px) 50vw, 100vw"| |cropPosition|Sharp crop position, e.g. gravity.centre| |lazyload|Set this to be true to lazyload images.|