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

@supernaut/next-image-storyblok-loader

v1.1.1

Published

Storyblok image loader for the Next.js Image component

Readme

Next Image Storyblok Loader

An image loader for the Next.js Image component to load images from Storyblok.

Inspired by @delicious-simplicity/next-image-imgix-loader.

Usage

Pass the loader to a Next.js Image component to load images from Storyblok directly instead of intermediate storage, resizing, etc on the Next.js server.

Install the package using your package manager of choice:

pnpm add @supernaut/next-image-storyblok-loader
npm install @supernaut/next-image-storyblok-loader
yarn add @supernaut/next-image-storyblok-loader

Basic Usage

Import the loader as is to use default settings.

import Image from "next/image";
import { storyblokImageLoader } from "@supernaut/next-image-storyblok-loader";

const Component = ({ image }) => {
  return (
    <Image
      loader={storyblokImageLoader}
      src={image.url}
      alt={image.title}
      width={image.width}
      height={image.height}
    />
  );
};

Create an Image Loader with Options

You can import the getStoryblokImageLoader function to construct a loader with options.

import Image from "next/image";
import { getStoryblokImageLoader } from "@supernaut/next-image-storyblok-loader";

const loader = getStoryblokImageLoader({ host: "my-custom-domain.com" });

const Component = ({ image }) => {
  return (
    <Image
      loader={loader}
      src={image.url}
      alt={image.title}
      width={image.width}
      height={image.height}
    />
  );
};

Create Image URL's for getImageProps

You use the getStoryblokImageSrc function to create image src URL's to use with getImageProps.

This can be useful for creating picture elements with editorial responsive behaviors. Here is a simplified example of a component taking a single source image from Storyblok and creating a picture element showing differently cropped images depending on the screen orientation.

iimport { getImageProps } from "next/image";
import {
  getStoryblokImageSrc,
  storyblokImageLoader,
} from "@supernaut/next-image-storyblok-loader";

const Component = ({ image }) => {
  const srcPortrait = getStoryblokImageSrc(image, {
    resize: {
      height: 800,
      width: 600,
    },
  });
  const srcLandscape = getStoryblokImageSrc(image, {
    resize: {
      height: 600,
      width: 800,
    },
  });
  const { props: propsPortrait } = getImageProps({
    ...image,
    src: srcPortrait,
    loader: storyblokImageLoader,
  });
  const { props: propsLandscape } = getImageProps({
    ...image,
    src: srcLandscape,
    loader: storyblokImageLoader,
  });

  return (
    <picture>
      <source media="(orientation: portrait)" {...propsPortrait} />
      <source media="(orientation: landscape)" {...propsLandscape} />
      <img {...propsLandscape} />
    </picture>
  );
};

Options

Setting Options

You can either provide options to the getStoryblokImageLoader function or set them with environment variables. Using environment variables is generally simpler, but if you need to set optios conditionally at runtime there might be scenarios where using options and the factory function works better.

Host

The default host is set to a.storyblok.com and can be overriden with either the STORYBLOK_IMAGE_LOADER_HOST environment variable or the host option.

This is intentionally host and not hostname and allows for setting an optional port if needed.

This is useful if you rewrite image requests to another hostname, or using Storyblok in a region outside the EU that might have a different subdomain.

Setting the host option to my-domain.com would change the generated src URL from https://a.storyblok.com/f/88751/2600x1214/2c6ef16b8f/hero-visual-editor.png/m/2600x0/ to https://my-domain.com/f/88751/2600x1214/2c6ef16b8f/hero-visual-editor.png/m/2600x0/.

Prefix

An optional overriding prefix can be set using the STORYBLOK_IMAGE_LOADER_PREFIX environment variable or the prefix option.

This is useful if you rewrite image requests to a pathname instead of a complete URL.

Setting the prefix option to /assets/storyblok would change the generated src URL from https://a.storyblok.com/f/88751/2600x1214/2c6ef16b8f/hero-visual-editor.png/m/2600x0/ to /assets/storyblok/f/88751/2600x1214/2c6ef16b8f/hero-visual-editor.png/m/2600x0/.