Ingen beskrivning
  • TypeScript 92.6%
  • JavaScript 7.4%
Hitta en fil
Kodförråd filer (senaste incheckning först)
Filnamn Senaste incheckningsmeddelande Senaste incheckningsdatum
Bitborg Renovate 45d10b0239
Alla kontroller lyckades
CI / ci (push) Successful in 1m1s
Release / Release (push) Successful in 1m1s
chore(deps): lock file maintenance (#25)
This PR contains the following updates:

| Update | Change |
|---|---|
| lockFileMaintenance | All locks refreshed |

🔧 This Pull Request updates lock files to use the latest dependency versions.

---

### Configuration

📅 **Schedule**: (in timezone Europe/Stockholm)

- Branch creation
  - "before 6am on monday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yODguMCIsInVwZGF0ZWRJblZlciI6IjQzLjI4OC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL2Nob3JlIl19-->

Reviewed-on: #25
2026-10-12 07:30:23 +00:00
.changeset chore: group renovate updates (#13) 2026-10-02 21:20:36 +00:00
.forgejo/workflows chore: group renovate updates (#13) 2026-10-02 21:20:36 +00:00
.github chore: group renovate updates (#13) 2026-10-02 21:20:36 +00:00
src refactor: improve testability 2025-08-22 10:17:26 +02:00
.gitignore refactor: split entry and use more modern config (#1) 2025-06-05 14:10:50 +02:00
.npmignore chore: group renovate updates (#13) 2026-10-02 21:20:36 +00:00
.prettierignore test: add tests (#2) 2025-06-09 07:58:16 +02:00
.prettierrc test: add tests (#2) 2025-06-09 07:58:16 +02:00
CHANGELOG.md chore: release v1.1.1 2025-08-22 10:18:52 +02:00
commitlint.config.js chore: group renovate updates (#13) 2026-10-02 21:20:36 +00:00
eslint.config.mjs style: improve and apply linting rules 2025-08-22 10:01:15 +02:00
lefthook.json test: add tests (#2) 2025-06-09 07:58:16 +02:00
LICENSE feat: add basic functionality 2025-03-05 11:56:04 +01:00
package.json chore(deps): update dependency next to v15.5.27 [security] (#24) 2026-10-08 06:15:11 +00:00
pnpm-lock.yaml chore(deps): lock file maintenance (#25) 2026-10-12 07:30:23 +00:00
pnpm-workspace.yaml fix: add build step to release pipeline 2025-08-22 09:55:33 +02:00
readme.md style: improve and apply linting rules 2025-08-22 10:01:15 +02:00
release.md chore: group renovate updates (#13) 2026-10-02 21:20:36 +00:00
renovate.json fix: stop renovate pinning engines (#21) 2026-10-05 09:03:33 +00:00
tsconfig.json fix: declare node types explicitly for vitest v4 (#22) 2026-10-05 09:17:01 +00:00
tsup.config.ts test: add tests (#2) 2025-06-09 07:58:16 +02:00
vitest.config.ts refactor: improve testability 2025-08-22 10:17:26 +02:00

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/.